public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm2-cvs@sourceware.org
Subject: LVM2/lib/format_text export.c format-text.c im ...
Date: Sat, 07 Oct 2006 23:17:00 -0000	[thread overview]
Message-ID: <20061007231717.13649.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-10-07 23:17:17

Modified files:
	lib/format_text: export.c format-text.c import_vsn1.c 

Log message:
	More work towards pv->size always holding the same value in internal metadata.
	Store it in external text metadata as dev_size, and estimate it if not
	present when metadata is read back in.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/export.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.67&r2=1.68
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36

--- LVM2/lib/format_text/export.c	2006/08/21 12:54:52	1.52
+++ LVM2/lib/format_text/export.c	2006/10/07 23:17:17	1.53
@@ -409,6 +409,11 @@
 			outf(f, "tags = %s", buffer);
 		}
 
+		if (!out_size(f, pv->size, "dev_size = %" PRIu64, pv->size)) {
+			stack;
+			return 0;
+		}
+
 		outf(f, "pe_start = %" PRIu64, pv->pe_start);
 		if (!out_size(f, vg->extent_size * (uint64_t) pv->pe_count,
 			      "pe_count = %u", pv->pe_count)) {
--- LVM2/lib/format_text/format-text.c	2006/10/05 22:02:52	1.67
+++ LVM2/lib/format_text/format-text.c	2006/10/07 23:17:17	1.68
@@ -1465,8 +1465,16 @@
 			}
 		}
 
+		/* FIXME Cope with genuine pe_count 0 */
+
+		/* If missing, estimate pv->size from file-based metadata */
+		if (!pv->size && pv->pe_count)
+			pv->size = pv->pe_count * (uint64_t) vg->extent_size +
+				   pv->pe_start + mda_size2;
+
 		/* Recalculate number of extents that will fit */
-		pv->pe_count = (pv->size - pv->pe_start - mda_size2) / vg->extent_size;
+		if (!pv->pe_count)
+			pv->pe_count = (pv->size - pv->pe_start - mda_size2) / vg->extent_size;
 
 		/* Unlike LVM1, we don't store this outside a VG */
 		/* FIXME Default from config file? vgextend cmdline flag? */
--- LVM2/lib/format_text/import_vsn1.c	2006/05/09 21:23:50	1.35
+++ LVM2/lib/format_text/import_vsn1.c	2006/10/07 23:17:17	1.36
@@ -179,6 +179,9 @@
 		return 0;
 	}
 
+	/* Late addition */
+	_read_int64(pvn, "dev_size", &pv->size);
+
 	if (!_read_int64(pvn, "pe_start", &pv->pe_start)) {
 		log_error("Couldn't read extent size for volume group.");
 		return 0;
@@ -206,7 +209,7 @@
 	vg->free_count += pv->pe_count;
 
 	pv->pe_size = vg->extent_size;
-	pv->size = vg->extent_size * (uint64_t) pv->pe_count;
+
 	pv->pe_alloc_count = 0;
 	pv->fmt = fid->fmt;
 


                 reply	other threads:[~2006-10-07 23:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061007231717.13649.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --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).