This is the mail archive of the
lvm2-cvs@sourceware.org
mailing list for the LVM2 project.
LVM2/lib/format_text export.c format-text.c im ...
- From: agk at sourceware dot org
- To: lvm2-cvs at sourceware dot org
- Date: 7 Oct 2006 23:17:17 -0000
- Subject: LVM2/lib/format_text export.c format-text.c im ...
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;