public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/format_text/format-text.c ...
Date: Thu, 05 Oct 2006 22:02:00 -0000	[thread overview]
Message-ID: <20061005220252.6413.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-10-05 22:02:52

Modified files:
	.              : WHATS_NEW 
	lib/format_text: format-text.c 
	lib/metadata   : metadata.c 

Log message:
	Fix format_text mda_setup pv->size and pv_setup pe_count calculations.
	
	(This area of the code needs a lot more work.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.454&r2=1.455
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.66&r2=1.67
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.98&r2=1.99

--- LVM2/WHATS_NEW	2006/10/05 21:24:46	1.454
+++ LVM2/WHATS_NEW	2006/10/05 22:02:52	1.455
@@ -1,5 +1,6 @@
 Version 2.02.11 - 
 =====================================
+  Fix format_text mda_setup pv->size and pv_setup pe_count calculations.
   Fix _for_each_pv() for mirror with core log.
   Add lvm_dump.sh script to create a tarball of debugging info from a system.
   Capture error messages in clvmd and pass them back to the user.
--- LVM2/lib/format_text/format-text.c	2006/08/21 12:54:52	1.66
+++ LVM2/lib/format_text/format-text.c	2006/10/05 22:02:52	1.67
@@ -1007,11 +1007,8 @@
 	uint64_t wipe_size = 8 << SECTOR_SHIFT;
 	size_t pagesize = lvm_getpagesize();
 
-	if (!pvmetadatacopies) {
-		/* Space available for PEs */
-		pv->size -= pe_align();
+	if (!pvmetadatacopies)
 		return 1;
-	}
 
 	alignment = pe_align() << SECTOR_SHIFT;
 	disk_size = pv->size << SECTOR_SHIFT;
@@ -1027,9 +1024,6 @@
 	/* Requested metadatasize */
 	mda_size1 = pvmetadatasize << SECTOR_SHIFT;
 
-	/* Space available for PEs (before any mdas created) */
-	pv->size -= LABEL_SCAN_SECTORS;
-
 	/* Place mda straight after label area at start of disk */
 	start1 = LABEL_SCAN_SIZE;
 
@@ -1037,11 +1031,8 @@
 	if ((!pe_start && !pe_end) ||
 	    ((pe_start > start1) && (pe_start - start1 >= MDA_SIZE_MIN))) {
 		mda_adjustment = start1 % pagesize;
-		if (mda_adjustment) {
+		if (mda_adjustment)
 			start1 += (pagesize - mda_adjustment);
-			pv->size -= ((pagesize - mda_adjustment) >>
-				     SECTOR_SHIFT);
-		}
 	}
 
 	/* Ensure it's not going to be bigger than the disk! */
@@ -1071,7 +1062,8 @@
 	/* FIXME If creating new mdas, wipe them! */
 	if (mda_size1) {
 		if (!add_mda(fmt, fmt->cmd->mem, mdas, pv->dev, start1,
-			     mda_size1)) return 0;
+			     mda_size1))
+			return 0;
 
 		if (!dev_set((struct device *) pv->dev, start1,
 			     (size_t) (mda_size1 >
@@ -1080,7 +1072,6 @@
 			return 0;
 		}
 
-		pv->size -= mda_size1 >> SECTOR_SHIFT;
 		if (pvmetadatacopies == 1)
 			return 1;
 	} else
@@ -1125,7 +1116,6 @@
 			log_error("Failed to wipe new metadata area");
 			return 0;
 		}
-		pv->size -= mda_size2 >> SECTOR_SHIFT;
 	} else
 		return 0;
 
@@ -1416,8 +1406,8 @@
 	struct lvmcache_info *info;
 	int found;
 	uint64_t pe_end = 0;
-
-	/* FIXME if vg, adjust start/end of pe area to avoid mdas! */
+	unsigned mda_count = 0;
+	uint64_t mda_size2 = 0;
 
 	/* FIXME Cope with pvchange */
 	/* FIXME Merge code with _text_create_text_instance */
@@ -1428,11 +1418,16 @@
 		if ((info = info_from_pvid(pv->dev->pvid))) {
 			pvmdas = &info->mdas;
 			list_iterate_items(mda, pvmdas) {
+				mda_count++;
 				mdac =
 				    (struct mda_context *) mda->metadata_locn;
 
 				/* FIXME Check it isn't already in use */
 
+				/* Reduce usable device size */
+				if (mda_count > 1)
+					mda_size2 = mdac->area.size >> SECTOR_SHIFT;
+
 				/* Ensure it isn't already on list */
 				found = 0;
 				list_iterate_items(mda2, mdas) {
@@ -1470,6 +1465,9 @@
 			}
 		}
 
+		/* Recalculate number of extents that will fit */
+		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? */
 		pv->status |= ALLOCATABLE_PV;
--- LVM2/lib/metadata/metadata.c	2006/09/21 20:25:54	1.98
+++ LVM2/lib/metadata/metadata.c	2006/10/05 22:02:52	1.99
@@ -734,6 +734,8 @@
 	char uuid[64];
 	int r = 1;
 
+	/* FIXME Also check there's no data/metadata overlap */
+
 	list_iterate_items(pvl, &vg->pvs) {
 		list_iterate_items(pvl2, &vg->pvs) {
 			if (pvl == pvl2)


             reply	other threads:[~2006-10-05 22:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-05 22:02 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-05-09 12:31 prajnoha
2011-04-21 13:13 zkabelac
2011-02-28 13:19 prajnoha
2011-02-25 14:08 prajnoha
2009-05-07 12:11 mbroz
2007-11-05 17:17 agk
2007-04-25 21:10 wysochanski
2007-03-23 12:43 mbroz
2007-01-09 21:12 agk
2006-08-17 19:53 agk
2006-08-17 19:31 agk
2006-04-29 22:08 agk
2005-09-01 18:37 agk
2005-04-06 18:59 agk
2005-01-20 18:11 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=20061005220252.6413.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).