mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-08 08:58:50 +03:00
Show 'not usable' space when PV is too large for device in pvdisplay.
Ignore and fix up any excessive device size found in metadata.
This commit is contained in:
parent
2b0249ec42
commit
fd4ff5d201
@ -1,6 +1,8 @@
|
||||
Version 2.02.29 -
|
||||
==================================
|
||||
Add LVM2 version to 'Generated by' comment in metadata.
|
||||
Show 'not usable' space when PV is too large for device in pvdisplay.
|
||||
Ignore and fix up any excessive device size found in metadata.
|
||||
Fix error message when fixing up PV size in lvm2 metadata (2.02.11).
|
||||
Fix orphan-related locking in pvdisplay and pvs.
|
||||
Fix missing VG unlocks in some pvchange error paths.
|
||||
|
@ -295,6 +295,7 @@ void pvdisplay_full(const struct cmd_context *cmd,
|
||||
const char *size;
|
||||
|
||||
uint32_t pe_free;
|
||||
uint64_t used_size, pvsize, unusable;
|
||||
|
||||
if (!pv)
|
||||
return;
|
||||
@ -309,19 +310,20 @@ void pvdisplay_full(const struct cmd_context *cmd,
|
||||
log_print("VG Name %s%s", pv->vg_name,
|
||||
pv->status & EXPORTED_VG ? " (exported)" : "");
|
||||
|
||||
size = display_size(cmd, (uint64_t) pv->size);
|
||||
if (pv->pe_size && pv->pe_count) {
|
||||
used_size = (uint64_t) pv->pe_count * pv->pe_size;
|
||||
if (pv->size > used_size) {
|
||||
pvsize = pv->size;
|
||||
unusable = pvsize - used_size;
|
||||
} else {
|
||||
pvsize = used_size;
|
||||
unusable = used_size - pv->size;
|
||||
}
|
||||
|
||||
/******** FIXME display LVM on-disk data size
|
||||
size2 = display_size(cmd, pv->size);
|
||||
********/
|
||||
|
||||
log_print("PV Size %s" " / not usable %s", /* [LVM: %s]", */
|
||||
size,
|
||||
display_size(cmd, (pv->size -
|
||||
(uint64_t) pv->pe_count * pv->pe_size)));
|
||||
|
||||
} else
|
||||
size = display_size(cmd, pvsize);
|
||||
if (used_size)
|
||||
log_print("PV Size %s / not usable %s", /* [LVM: %s]", */
|
||||
size, display_size(cmd, unusable));
|
||||
else
|
||||
log_print("PV Size %s", size);
|
||||
|
||||
/* PV number not part of LVM2 design
|
||||
|
@ -95,8 +95,8 @@ int import_pv(const struct format_type *fmt, struct dm_pool *mem,
|
||||
pv->pe_count = pvd->pe_total;
|
||||
pv->pe_alloc_count = 0;
|
||||
|
||||
/* Fix up pv size if missing */
|
||||
if (!pv->size) {
|
||||
/* Fix up pv size if missing or impossibly large */
|
||||
if (!pv->size || pv->size > (1ULL << 62)) {
|
||||
if (!dev_get_size(dev, &pv->size)) {
|
||||
log_error("%s: Couldn't get size.", pv_dev_name(pv));
|
||||
return 0;
|
||||
|
@ -215,8 +215,8 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
|
||||
pv->pe_alloc_count = 0;
|
||||
pv->fmt = fid->fmt;
|
||||
|
||||
/* Fix up pv size if missing */
|
||||
if (!pv->size && pv->dev) {
|
||||
/* Fix up pv size if missing or impossibly large */
|
||||
if ((!pv->size || pv->size > (1ULL << 62)) && pv->dev) {
|
||||
if (!dev_get_size(pv->dev, &pv->size)) {
|
||||
log_error("%s: Couldn't get size.", pv_dev_name(pv));
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user