From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23452 invoked by alias); 5 Nov 2007 01:47:50 -0000 Received: (qmail 23438 invoked by uid 9447); 5 Nov 2007 01:47:49 -0000 Date: Mon, 05 Nov 2007 01:47:00 -0000 Message-ID: <20071105014749.23436.qmail@sourceware.org> From: agk@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/display/display.c lib/for ... Mailing-List: contact lvm2-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: lvm2-cvs-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00006.txt.bz2 CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: agk@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 --- LVM2/WHATS_NEW 2007/11/04 19:16:34 1.727 +++ LVM2/WHATS_NEW 2007/11/05 01:47:47 1.728 @@ -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. --- LVM2/lib/display/display.c 2007/10/12 14:29:31 1.79 +++ LVM2/lib/display/display.c 2007/11/05 01:47:48 1.80 @@ -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 --- LVM2/lib/format1/import-export.c 2007/11/02 20:40:04 1.89 +++ LVM2/lib/format1/import-export.c 2007/11/05 01:47:48 1.90 @@ -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; --- LVM2/lib/format_text/import_vsn1.c 2007/11/04 15:43:50 1.43 +++ LVM2/lib/format_text/import_vsn1.c 2007/11/05 01:47:49 1.44 @@ -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;