mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
o lvdisplay now shows LE / PV map
o fix LE allocation when first PV is full o reduce VG free_count when removing PVs from VG
This commit is contained in:
parent
30f7ee62e8
commit
e68b5e3029
@ -65,7 +65,8 @@ char *display_size(unsigned long long size, size_len_t sl)
|
||||
* creates a new uuid string with -'s in it. It would be better if
|
||||
* the destination was passed in as well. EJT
|
||||
*/
|
||||
char *display_uuid(char *uuidstr) {
|
||||
char *display_uuid(char *uuidstr)
|
||||
{
|
||||
int i, j;
|
||||
char *uuid;
|
||||
|
||||
@ -103,9 +104,7 @@ void pvdisplay_colons(struct physical_volume *pv)
|
||||
uuid = display_uuid(pv->id.uuid);
|
||||
|
||||
log_print("%s:%s:%llu:-1:%u:%u:-1:%llu:%u:%u:%u:%s",
|
||||
dev_name(pv->dev),
|
||||
pv->vg_name,
|
||||
pv->size,
|
||||
dev_name(pv->dev), pv->vg_name, pv->size,
|
||||
/* FIXME pv->pv_number, Derive or remove? */
|
||||
pv->status, /* FIXME Support old or new format here? */
|
||||
pv->status & ALLOCATED_PV, /* FIXME Remove? */
|
||||
@ -113,8 +112,7 @@ void pvdisplay_colons(struct physical_volume *pv)
|
||||
pv->pe_size / 2,
|
||||
pv->pe_count,
|
||||
pv->pe_count - pv->pe_allocated,
|
||||
pv->pe_allocated,
|
||||
*uuid ? uuid : "none");
|
||||
pv->pe_allocated, *uuid ? uuid : "none");
|
||||
|
||||
dbg_free(uuid);
|
||||
|
||||
@ -146,8 +144,7 @@ void pvdisplay_full(struct physical_volume * pv)
|
||||
size2 = display_size(pv->size / 2, SIZE_SHORT);
|
||||
********/
|
||||
|
||||
log_print("PV Size %s"
|
||||
" / not usable %s", /* [LVM: %s]", */
|
||||
log_print("PV Size %s" " / not usable %s", /* [LVM: %s]", */
|
||||
size, size1); /* , size2); */
|
||||
|
||||
dbg_free(size1);
|
||||
@ -216,22 +213,15 @@ void lvdisplay_colons(struct logical_volume *lv)
|
||||
(lv->status & (LVM_READ | LVM_WRITE)) >> 8,
|
||||
lv->status & ACTIVE,
|
||||
/* FIXME lv->lv_number, */
|
||||
lvs_in_vg_opened(lv->vg),
|
||||
lv->size,
|
||||
lv->le_count,
|
||||
/* FIXME num allocated? */
|
||||
(lv->status & (ALLOC_STRICT | ALLOC_CONTIGUOUS)) >> 12,
|
||||
lv->read_ahead
|
||||
lvs_in_vg_opened(lv->vg), lv->size, lv->le_count,
|
||||
/* FIXME Add num allocated to struct! lv->lv_allocated_le, */
|
||||
((lv->status & ALLOC_STRICT) +
|
||||
(lv->status & ALLOC_CONTIGUOUS) * 2), lv->read_ahead
|
||||
/* FIXME device num MAJOR(lv->lv_dev), MINOR(lv->lv_dev) */
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
void lvdisplay_extents(struct logical_volume *lv)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void lvdisplay_full(struct logical_volume *lv)
|
||||
{
|
||||
char *size;
|
||||
@ -313,7 +303,6 @@ void lvdisplay_full(struct logical_volume *lv)
|
||||
#endif
|
||||
********/
|
||||
|
||||
|
||||
size = display_size(lv->size / 2, SIZE_SHORT);
|
||||
log_print("LV Size %s", size);
|
||||
dbg_free(size);
|
||||
@ -363,7 +352,6 @@ void lvdisplay_full(struct logical_volume *lv)
|
||||
***********/
|
||||
}
|
||||
|
||||
|
||||
/**************
|
||||
#ifdef LVM_FUTURE
|
||||
printf("Bad block ");
|
||||
@ -374,13 +362,15 @@ void lvdisplay_full(struct logical_volume *lv)
|
||||
#endif
|
||||
***************/
|
||||
|
||||
/* FIXME next free == ALLOC_SIMPLE */
|
||||
alloc = lv->status & (ALLOC_STRICT | ALLOC_CONTIGUOUS);
|
||||
log_print("Allocation %s%s%s%s",
|
||||
!(alloc & (ALLOC_STRICT | ALLOC_CONTIGUOUS)) ? "next free" : "",
|
||||
(alloc == ALLOC_STRICT) ? "strict" : "",
|
||||
!(alloc & (ALLOC_STRICT | ALLOC_CONTIGUOUS)) ? "next free" :
|
||||
"", (alloc == ALLOC_STRICT) ? "strict" : "",
|
||||
(alloc == ALLOC_CONTIGUOUS) ? "contiguous" : "",
|
||||
(alloc == (ALLOC_STRICT | ALLOC_CONTIGUOUS)) ? "strict/contiguous" : ""
|
||||
);
|
||||
(alloc ==
|
||||
(ALLOC_STRICT | ALLOC_CONTIGUOUS)) ? "strict/contiguous" :
|
||||
"");
|
||||
|
||||
log_print("Read ahead sectors %u\n", lv->read_ahead);
|
||||
|
||||
@ -402,3 +392,43 @@ void lvdisplay_full(struct logical_volume *lv)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void lvdisplay_extents(struct logical_volume *lv)
|
||||
{
|
||||
int le;
|
||||
struct list *pvh;
|
||||
struct physical_volume *pv;
|
||||
|
||||
log_verbose("--- Distribution of logical volume on physical "
|
||||
"volumes ---");
|
||||
log_verbose("PV Name PE on PV ");
|
||||
|
||||
list_iterate(pvh, &lv->vg->pvs) {
|
||||
int count = 0;
|
||||
pv = &list_item(pvh, struct pv_list)->pv;
|
||||
for (le = 0; le < lv->le_count; le++)
|
||||
if (lv->map[le].pv->dev == pv->dev)
|
||||
count++;
|
||||
if (count)
|
||||
log_verbose("%-25s %d", dev_name(pv->dev), count);
|
||||
}
|
||||
|
||||
/********* FIXME "reads writes"
|
||||
|
||||
|
||||
printf("\n --- logical volume i/o statistic ---\n"
|
||||
" %d reads %d writes\n", sum_reads, sum_writes);
|
||||
|
||||
******* */
|
||||
|
||||
log_verbose(" ");
|
||||
log_verbose("--- Logical extents ---");
|
||||
log_verbose("LE PV PE");
|
||||
|
||||
for (le = 0; le < lv->le_count; le++) {
|
||||
log_verbose("%05d %-25s %05u ", le,
|
||||
dev_name(lv->map[le].pv->dev), lv->map[le].pe);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "pv_map.h"
|
||||
#include "log.h"
|
||||
|
||||
|
||||
static int _create_maps(struct pool *mem, struct list *pvs, struct list *maps)
|
||||
{
|
||||
struct list *tmp;
|
||||
@ -29,6 +28,8 @@ static int _create_maps(struct pool *mem, struct list *pvs, struct list *maps)
|
||||
return 0;
|
||||
}
|
||||
|
||||
list_init(&pvm->areas);
|
||||
|
||||
list_add(maps, &pvm->list);
|
||||
}
|
||||
|
||||
@ -97,7 +98,6 @@ static int _create_single_area(struct pool *mem, struct pv_map *pvm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
list_init(&pvm->areas);
|
||||
pva->start = b;
|
||||
pva->count = e - b;
|
||||
list_add(&pvm->areas, &pva->list);
|
||||
@ -171,4 +171,3 @@ struct list *create_pv_maps(struct pool *mem, struct volume_group *vg,
|
||||
pool_free(mem, maps);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -113,6 +113,8 @@ static int vgreduce_single(struct volume_group *vg, struct physical_volume *pv)
|
||||
list_del(pvh);
|
||||
*pv->vg_name = '\0';
|
||||
vg->pv_count--;
|
||||
vg->free_count -= pv->pe_count - pv->pe_allocated;
|
||||
vg->extent_count -= pv->pe_count;
|
||||
|
||||
if (!(fid->ops->vg_write(fid, vg))) {
|
||||
log_error("Removal of physical volume %s from %s failed",
|
||||
|
Loading…
x
Reference in New Issue
Block a user