LVM2 ./WHATS_NEW lib/display/display.c lib/for ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2007-11-05 01:47:49
Modified files:
. : WHATS_NEW lib/display : display.c lib/format1 : import-export.c
lib/format_text: import_vsn1.c
Log message:
Show 'not usable' space when PV is too large for device in pvdisplay. Ignore and fix up any excessive device size found in metadata.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.727&r2=1.728
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/display/display.c.diff?cvsroot=lvm2&r1=1.79&r2=1.80
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.89&r2=1.90
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.43&r2=1.44
WHATS_NEW +2 -0
@@ -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.
lib/display/display.c +14 -12
@@ -295,6 +295,7 @@const char *size;uint32_t pe_free; +uint64_t used_size, pvsize, unusable;if (!pv)return ;
@@ -309,19 +310,20 @@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) { - -/******** 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))); + 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; + } - }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
lib/format1/import-export.c +2 -2
@@ -95,8 +95,8 @@ 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 ;
lib/format_text/import_vsn1.c +2 -2
@@ -215,8 +215,8 @@ 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 ;