public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: wysochanski@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/lib/metadata metadata-exported.h metadata.c
Date: Tue, 13 Apr 2010 17:26:00 -0000	[thread overview]
Message-ID: <20100413172637.12698.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-04-13 17:26:36

Modified files:
	lib/metadata   : metadata-exported.h metadata.c 

Log message:
	Add pv->vg to solidify link between a pv and a vg.
	
	lvm2app needs a link back to the vg in order to use the vg handle for
	memory allocations as well as other things.  This patch adds the field
	to struct physical_volume, and sets pv->vg when reading a vg from disk or
	extending a vg by using the helper function previously added,
	add_pvl_to_vgs().  Moves and renames are handled with separate code
	inside move_pv() and vgmerge().  Add pv->vg check to vg_validate().
	
	A NULL value in pv->vg signifies membership in the orphan VG.
	Note though in the case of pv_read() on a device with metadatacopies == 0,
	more devices may need to be read for an authoritative answer.
	
	Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.140&r2=1.141
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.335&r2=1.336

--- LVM2/lib/metadata/metadata-exported.h	2010/04/13 17:25:44	1.140
+++ LVM2/lib/metadata/metadata-exported.h	2010/04/13 17:26:36	1.141
@@ -181,9 +181,20 @@
 	struct id id;
 	struct device *dev;
 	const struct format_type *fmt;
+
+	/*
+	 * vg_name and vgid are used before the parent VG struct exists.
+	 * FIXME: Investigate removal/substitution with 'vg' fields.
+	 */
 	const char *vg_name;
 	struct id vgid;
 
+	/*
+	 * 'vg' is set and maintained when the PV belongs to a 'pvs'
+	 * list in a parent VG struct.
+	 */
+	struct volume_group *vg;
+
 	uint64_t status;
 	uint64_t size;
 
--- LVM2/lib/metadata/metadata.c	2010/04/13 17:26:20	1.335
+++ LVM2/lib/metadata/metadata.c	2010/04/13 17:26:36	1.336
@@ -143,12 +143,14 @@
 {
 	dm_list_add(&vg->pvs, &pvl->list);
 	vg->pv_count++;
+	pvl->pv->vg = vg;
 }
 
 void del_pvl_from_vgs(struct volume_group *vg, struct pv_list *pvl)
 {
 	vg->pv_count--;
 	dm_list_del(&pvl->list);
+	pvl->pv->vg = NULL; /* orphan */
 }
 
 
@@ -2158,6 +2160,12 @@
 			/* FIXME Dump list structure? */
 			r = 0;
 		}
+		if (pvl->pv->vg != vg) {
+			log_error(INTERNAL_ERROR "VG %s PV list entry points "
+				  "to different VG %s", vg->name,
+				  pvl->pv->vg ? pvl->pv->vg->name : "NULL");
+			r = 0;
+		}
 	}
 
 	loop_counter1 = loop_counter2 = 0;


             reply	other threads:[~2010-04-13 17:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13 17:26 wysochanski [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-06-29 22:41 wysochanski
2010-06-28 20:36 wysochanski
2010-05-19 11:52 wysochanski
2009-07-26  2:02 wysochanski
2009-07-26  1:53 wysochanski
2009-07-15 17:26 agk
2009-07-15  6:10 mornfall
2009-07-10 21:19 wysochanski
2009-07-08 14:31 wysochanski
2009-07-08 14:28 wysochanski
2009-06-09 14:29 wysochanski
2009-01-27  1:48 agk
2009-01-27  0:40 agk
2009-01-26 22:13 agk
2008-03-13 22:51 wysochanski

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