public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/display/display.c lib/for ...
Date: Mon, 05 Nov 2007 01:47:00 -0000	[thread overview]
Message-ID: <20071105014749.23436.qmail@sourceware.org> (raw)

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;


             reply	other threads:[~2007-11-05  1:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-05  1:47 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-11-24 22:56 snitzer
2009-09-15 18:35 wysochanski
2007-10-12 14:29 wysochanski
2006-11-10 18:24 agk
2004-06-07 15:22 agk
2004-05-18 22:12 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071105014749.23436.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).