public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2010-06-29 22:41 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2010-06-29 22:41 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-06-29 22:41:29

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

Log message:
	Improve logging for setting --vgmetadatacopies.
	
	Example of logging:
	metadata/metadata.c:1127     Setting mda_copies = 3 on vg vgtest
	metadata/pv_manip.c:296         /dev/loop2 0:      0     25: NULL(0:0)
	metadata/pv_manip.c:296         /dev/loop3 0:      0     25: NULL(0:0)
	metadata/pv_manip.c:296         /dev/loop4 0:      0     25: NULL(0:0)
	metadata/metadata.c:1072     Adjusting ignored mdas on vg vgtest, vg_mda_used_count=5, vg_mda_copies=3
	metadata/metadata.c:1015     Setting ignore flag for 2 mdas on vg vgtest
	metadata/metadata.c:4151     Setting mda ignored flag for metadata_locn /dev/loop2.
	metadata/metadata.c:4151     Setting mda ignored flag for metadata_locn /dev/loop3.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.159&r2=1.160
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.366&r2=1.367

--- LVM2/lib/metadata/metadata-exported.h	2010/06/29 21:32:44	1.159
+++ LVM2/lib/metadata/metadata-exported.h	2010/06/29 22:41:28	1.160
@@ -886,7 +886,7 @@
 #define VGMETADATACOPIES_ALL UINT32_MAX
 #define VGMETADATACOPIES_UNMANAGED 0
 uint32_t vg_mda_copies(const struct volume_group *vg);
-int vg_set_mda_copies(struct volume_group *vg, uint32_t value);
+int vg_set_mda_copies(struct volume_group *vg, uint32_t copies);
 int vg_check_write_mode(struct volume_group *vg);
 #define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED)
 #define vg_is_exported(vg) (vg_status((vg)) & EXPORTED_VG)
--- LVM2/lib/metadata/metadata.c	2010/06/29 22:37:32	1.366
+++ LVM2/lib/metadata/metadata.c	2010/06/29 22:41:28	1.367
@@ -1011,6 +1011,8 @@
 {
 	struct metadata_area *mda;
 
+	log_verbose("Setting ignore flag for %"PRIu32" mdas on vg %s",
+		    num_to_ignore, vg->name);
 	if (!num_to_ignore)
 		return 1;
 	/* FIXME: flip bits on random mdas */
@@ -1031,6 +1033,8 @@
 {
 	struct metadata_area *mda, *tmda;
 
+	log_verbose("Clearing ignore flag for %"PRIu32" mdas on vg %s",
+		    num_to_unignore, vg->name);
 	if (!num_to_unignore)
 		return 1;
 	/* FIXME: flip bits on random mdas */
@@ -1063,6 +1067,9 @@
 	int ret = 1;
 
 	mda_copies = vg_mda_used_count(vg);
+	log_verbose("Adjusting ignored mdas on vg %s, vg_mda_used_count=%"
+		    PRIu32", vg_mda_copies=%"PRIu32,
+		    vg->name, mda_copies, vg_mda_copies(vg));
 	if (vg->mda_copies == VGMETADATACOPIES_UNMANAGED)
 		goto skip_adjust;
 
@@ -1108,14 +1115,16 @@
 	return vg->mda_copies;
 }
 
-int vg_set_mda_copies(struct volume_group *vg, uint32_t value)
+int vg_set_mda_copies(struct volume_group *vg, uint32_t copies)
 {
 	/* FIXME: add checks, etc, and set the value */
 	/*
 	 * FIXME: Before we set a larger value, we may need to
 	 * enable some mdas on PVS
 	 */
-	vg->mda_copies = value;
+	vg->mda_copies = copies;
+	log_verbose("Setting mda_copies = %"PRIu32" on vg %s",
+		    copies, vg->name);
 	return 1;
 }
 


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2010-06-28 20:36 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2010-06-28 20:36 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-06-28 20:36:56

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

Log message:
	Add vg get/set methods for VG metadata copies.
	
	This patch adds the get and partially implemented set function.
	The 'set' function should probably ignore or un-ignore metadata areas
	based on new values.
	
	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.156&r2=1.157
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.358&r2=1.359

--- LVM2/lib/metadata/metadata-exported.h	2010/06/28 20:36:37	1.156
+++ LVM2/lib/metadata/metadata-exported.h	2010/06/28 20:36:56	1.157
@@ -882,6 +882,8 @@
 uint64_t vg_max_lv(const struct volume_group *vg);
 uint32_t vg_mda_count(const struct volume_group *vg);
 uint32_t vg_mda_used_count(const struct volume_group *vg);
+uint32_t vg_mda_copies(const struct volume_group *vg);
+int vg_set_mda_copies(struct volume_group *vg, uint32_t value);
 int vg_check_write_mode(struct volume_group *vg);
 #define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED)
 #define vg_is_exported(vg) (vg_status((vg)) & EXPORTED_VG)
--- LVM2/lib/metadata/metadata.c	2010/06/28 20:36:37	1.358
+++ LVM2/lib/metadata/metadata.c	2010/06/28 20:36:56	1.359
@@ -989,6 +989,22 @@
 	return 1;
 }
 
+uint32_t vg_mda_copies(const struct volume_group *vg)
+{
+	return vg->mda_copies;
+}
+
+int vg_set_mda_copies(struct volume_group *vg, uint32_t value)
+{
+	/* FIXME: add checks, etc, and set the value */
+	/*
+	 * FIXME: Before we set a larger value, we may need to
+	 * enable some mdas on PVS
+	 */
+	vg->mda_copies = value;
+	return 1;
+}
+
 int vg_set_extent_size(struct volume_group *vg, uint32_t new_size)
 {
 	uint32_t old_size = vg->extent_size;


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2010-05-19 11:52 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2010-05-19 11:52 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-05-19 11:52:38

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

Log message:
	Add find_vgname_from_{pvname|pvid} functions.
	
	Some commands start with a pvname, but we'd like to force users to
	start with a vg handle to obtain a pv handle.  Our best option seems
	to be providing a way to look up the vgname from the pvname, and then
	require them to use vg_read/vg_open.
	
	In addition to the pvname lookup function, this patch also provides a
	lookup by pvid.  The lookup by pvid can be used in conjunction with
	lvmcache_get_pvids to process all pvs in the system.
	
	The pvid find function first calls lvmcache_vgname_from_pvid, which may
	cause the label to be read if it is not in the cache.  If the vgname is
	returned is an orphan, we then check to see if there are metadata areas,
	and if not, we scan every PV on the system by calling scan_vgs_for_pvs().
	In most cases we should not need to do this, and by using the info->mdas
	count, we avoid calling pv_read() as prior code did.  So this patch is a
	bit cleaner and should allow us to refactor more of the pv code.
	
	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.145&r2=1.146
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.342&r2=1.343

--- LVM2/lib/metadata/metadata-exported.h	2010/05/19 02:08:51	1.145
+++ LVM2/lib/metadata/metadata-exported.h	2010/05/19 11:52:37	1.146
@@ -625,6 +625,10 @@
 struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
 					const char *pv_name);
 
+const char *find_vgname_from_pvname(struct cmd_context *cmd,
+				    const char *pvname);
+const char *find_vgname_from_pvid(struct cmd_context *cmd,
+				  const char *pvid);
 /* Find LV segment containing given LE */
 struct lv_segment *first_seg(const struct logical_volume *lv);
 
--- LVM2/lib/metadata/metadata.c	2010/05/19 02:36:33	1.342
+++ LVM2/lib/metadata/metadata.c	2010/05/19 11:52:37	1.343
@@ -3110,6 +3110,52 @@
 	return NULL;
 }
 
+
+const char *find_vgname_from_pvid(struct cmd_context *cmd,
+				  const char *pvid)
+{
+	char *vgname;
+	struct lvmcache_info *info;
+
+	vgname = lvmcache_vgname_from_pvid(cmd, pvid);
+
+	if (is_orphan_vg(vgname)) {
+		if (!(info = info_from_pvid(pvid, 0))) {
+			return_NULL;
+		}
+		/*
+		 * If an orphan PV has no MDAs it may appear to be an
+		 * orphan until the metadata is read off another PV in
+		 * the same VG.  Detecting this means checking every VG
+		 * by scanning every PV on the system.
+		 */
+		if (!dm_list_size(&info->mdas)) {
+			if (!scan_vgs_for_pvs(cmd)) {
+				log_error("Rescan for PVs without "
+					  "metadata areas failed.");
+				return NULL;
+			}
+		}
+		/* Ask lvmcache again - we may have a non-orphan name now */
+		vgname = lvmcache_vgname_from_pvid(cmd, pvid);
+	}
+	return vgname;
+}
+
+
+const char *find_vgname_from_pvname(struct cmd_context *cmd,
+				    const char *pvname)
+{
+	const char *pvid;
+
+	pvid = pvid_from_devname(cmd, pvname);
+	if (!pvid)
+		/* Not a PV */
+		return NULL;
+
+	return find_vgname_from_pvid(cmd, pvid);
+}
+
 /**
  * pv_read - read and return a handle to a physical volume
  * @cmd: LVM command initiating the pv_read


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2010-04-13 17:26 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2010-04-13 17:26 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

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;


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-07-26  2:02 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2009-07-26  2:02 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-07-26 02:02:22

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

Log message:
	Remove use of void * from pvcreate_single.
	
	We should use struct pvcreate_params to utilize compiler typechecking.
	
	Author: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.98&r2=1.99
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.265&r2=1.266

--- LVM2/lib/metadata/metadata-exported.h	2009/07/26 01:53:57	1.98
+++ LVM2/lib/metadata/metadata-exported.h	2009/07/26 02:02:22	1.99
@@ -355,7 +355,7 @@
 };
 
 pv_t * pvcreate_single(struct cmd_context *cmd, const char *pv_name,
-		       void *handle);
+		       struct pvcreate_params *pp);
 
 /*
 * Utility functions
--- LVM2/lib/metadata/metadata.c	2009/07/26 01:54:20	1.265
+++ LVM2/lib/metadata/metadata.c	2009/07/26 02:02:22	1.266
@@ -1119,19 +1119,16 @@
  * pv_t * (non-NULL): handle to physical volume created
  */
 pv_t * pvcreate_single(struct cmd_context *cmd, const char *pv_name,
-		       void *handle)
+		       struct pvcreate_params *pp)
 {
-	struct pvcreate_params *pp;
 	void *pv;
 	struct device *dev;
 	struct dm_list mdas;
 	struct pvcreate_params default_pp;
 
 	fill_default_pvcreate_params(&default_pp);
-	if (!handle)
+	if (!pp)
 		pp = &default_pp;
-	else
-		pp = (struct pvcreate_params *) handle;
 
 	if (pp->idp) {
 		if ((dev = device_from_pvid(cmd, pp->idp)) &&


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-07-26  1:53 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2009-07-26  1:53 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-07-26 01:53:57

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

Log message:
	Change pvcreate_single to return pv_t and update function description.
	
	Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
	
	Author: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.97&r2=1.98
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.263&r2=1.264

--- LVM2/lib/metadata/metadata-exported.h	2009/07/26 01:53:09	1.97
+++ LVM2/lib/metadata/metadata-exported.h	2009/07/26 01:53:57	1.98
@@ -354,7 +354,8 @@
 	unsigned yes;
 };
 
-int pvcreate_single(struct cmd_context *cmd, const char *pv_name, void *handle);
+pv_t * pvcreate_single(struct cmd_context *cmd, const char *pv_name,
+		       void *handle);
 
 /*
 * Utility functions
--- LVM2/lib/metadata/metadata.c	2009/07/26 01:53:30	1.263
+++ LVM2/lib/metadata/metadata.c	2009/07/26 01:53:57	1.264
@@ -1107,7 +1107,19 @@
 	pp->yes = 0;
 }
 
-int pvcreate_single(struct cmd_context *cmd, const char *pv_name, void *handle)
+/*
+ * pvcreate_single() - initialize a device with PV label and metadata
+ *
+ * Parameters:
+ * - pv_name: device path to initialize
+ * - handle: options to pass to pv_create; NULL indicates use defaults
+ *
+ * Returns:
+ * NULL: error
+ * pv_t * (non-NULL): handle to physical volume created
+ */
+pv_t * pvcreate_single(struct cmd_context *cmd, const char *pv_name,
+		       void *handle)
 {
 	struct pvcreate_params *pp;
 	void *pv;
@@ -1126,13 +1138,13 @@
 		    (dev != dev_cache_get(pv_name, cmd->filter))) {
 			log_error("uuid %s already in use on \"%s\"",
 				  pp->idp->uuid, dev_name(dev));
-			return 0;
+			return NULL;
 		}
 	}
 
 	if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
 		log_error("Can't get lock for orphan PVs");
-		return 0;
+		return NULL;
 	}
 
 	if (!pvcreate_check(cmd, pv_name, pp))
@@ -1192,11 +1204,11 @@
 	log_print("Physical volume \"%s\" successfully created", pv_name);
 
 	unlock_vg(cmd, VG_ORPHANS);
-	return 1;
+	return pv;
 
       error:
 	unlock_vg(cmd, VG_ORPHANS);
-	return 0;
+	return NULL;
 }
 
 static void _free_pv(struct dm_pool *mem, struct physical_volume *pv)


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-07-15 17:26 agk
  0 siblings, 0 replies; 16+ messages in thread
From: agk @ 2009-07-15 17:26 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2009-07-15 17:26:26

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

Log message:
	Revert broken commit:
	2009-07-15 06:10:51  Un-export vg_read_internal.
	
	lvm-functions.c:774: warning: implicit declaration of function 'vg_read_internal'

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.95&r2=1.96
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.254&r2=1.255

--- LVM2/lib/metadata/metadata-exported.h	2009/07/15 06:10:51	1.95
+++ LVM2/lib/metadata/metadata-exported.h	2009/07/15 17:26:26	1.96
@@ -343,6 +343,8 @@
 int vg_write(struct volume_group *vg);
 int vg_commit(struct volume_group *vg);
 int vg_revert(struct volume_group *vg);
+struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vg_name,
+			     const char *vgid, int *consistent);
 struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name,
 				struct dm_list *mdas, uint64_t *label_sector,
 				int warnings, int scan_label_only);
--- LVM2/lib/metadata/metadata.c	2009/07/15 06:10:51	1.254
+++ LVM2/lib/metadata/metadata.c	2009/07/15 17:26:26	1.255
@@ -31,9 +31,6 @@
 
 #include <sys/param.h>
 
-static struct volume_group *_vg_read_internal(struct cmd_context *cmd,
-					      const char *vgname,
-					      const char *vgid, int *consistent);
 /*
  * FIXME: Check for valid handle before dereferencing field or log error?
  */
@@ -253,8 +250,8 @@
 	struct pv_list *pvl;
 	int r = 0, consistent = 0;
 
-	if (!(vg = _vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) {
-		log_error("get_pv_from_vg_by_id: _vg_read_internal failed to read VG %s",
+	if (!(vg = vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) {
+		log_error("get_pv_from_vg_by_id: vg_read_internal failed to read VG %s",
 			  vg_name);
 		return 0;
 	}
@@ -626,7 +623,7 @@
 	/* FIXME: Is this vg_read_internal necessary? Move it inside
 	   vg_lock_newname? */
 	/* is this vg name already in use ? */
-	if ((vg = _vg_read_internal(cmd, vg_name, NULL, &consistent))) {
+	if ((vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) {
 		log_error("A volume group called '%s' already exists.", vg_name);
 		unlock_and_release_vg(cmd, vg, vg_name);
 		return _vg_make_handle(cmd, NULL, FAILED_EXIST);
@@ -2042,7 +2039,7 @@
 
 	if (is_orphan_vg(vgname)) {
 		if (use_precommitted) {
-			log_error("Internal error: _vg_read_internal requires vgname "
+			log_error("Internal error: vg_read_internal requires vgname "
 				  "with pre-commit.");
 			return NULL;
 		}
@@ -2331,9 +2328,8 @@
 	return correct_vg;
 }
 
-static struct volume_group *_vg_read_internal(struct cmd_context *cmd,
-					      const char *vgname,
-					      const char *vgid, int *consistent)
+struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgname,
+			     const char *vgid, int *consistent)
 {
 	struct volume_group *vg;
 	struct lv_list *lvl;
@@ -2374,7 +2370,7 @@
 
 /* This is only called by lv_from_lvid, which is only called from
  * activate.c so we know the appropriate VG lock is already held and
- * the _vg_read_internal is therefore safe.
+ * the vg_read_internal is therefore safe.
  */
 static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
 					    const char *vgid,
@@ -2407,7 +2403,7 @@
 	if (memlock())
 		goto out;
 
-	/* FIXME Need a genuine read by ID here - don't _vg_read_internal by name! */
+	/* FIXME Need a genuine read by ID here - don't vg_read_internal by name! */
 	/* FIXME Disabled vgrenames while active for now because we aren't
 	 *       allowed to do a full scan here any more. */
 
@@ -2598,7 +2594,7 @@
 			stack;
 			continue;
 		}
-		if (!(vg = _vg_read_internal(cmd, vgname, vgid, &consistent))) {
+		if (!(vg = vg_read_internal(cmd, vgname, vgid, &consistent))) {
 			stack;
 			continue;
 		}
@@ -2856,7 +2852,7 @@
 	if (!lock_vol(cmd, lock_name, lock_flags))
 		return_NULL;
 
-	if (!(vg = _vg_read_internal(cmd, vg_name, vgid, &consistent)))
+	if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent)))
 		return_NULL;
 
 	if (!consistent) {
@@ -2913,7 +2909,7 @@
 	consistent_in = consistent;
 
 	/* If consistent == 1, we get NULL here if correction fails. */
-	if (!(vg = _vg_read_internal(cmd, vg_name, vgid, &consistent))) {
+	if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent))) {
 		if (consistent_in && !consistent) {
 			log_error("Volume group \"%s\" inconsistent.", vg_name);
 			failure |= FAILED_INCONSISTENT;


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-07-15  6:10 mornfall
  0 siblings, 0 replies; 16+ messages in thread
From: mornfall @ 2009-07-15  6:10 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2009-07-15 06:10:51

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

Log message:
	Un-export vg_read_internal.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.94&r2=1.95
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.253&r2=1.254

--- LVM2/lib/metadata/metadata-exported.h	2009/07/15 05:50:22	1.94
+++ LVM2/lib/metadata/metadata-exported.h	2009/07/15 06:10:51	1.95
@@ -343,8 +343,6 @@
 int vg_write(struct volume_group *vg);
 int vg_commit(struct volume_group *vg);
 int vg_revert(struct volume_group *vg);
-struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vg_name,
-			     const char *vgid, int *consistent);
 struct physical_volume *pv_read(struct cmd_context *cmd, const char *pv_name,
 				struct dm_list *mdas, uint64_t *label_sector,
 				int warnings, int scan_label_only);
--- LVM2/lib/metadata/metadata.c	2009/07/15 05:50:22	1.253
+++ LVM2/lib/metadata/metadata.c	2009/07/15 06:10:51	1.254
@@ -31,6 +31,9 @@
 
 #include <sys/param.h>
 
+static struct volume_group *_vg_read_internal(struct cmd_context *cmd,
+					      const char *vgname,
+					      const char *vgid, int *consistent);
 /*
  * FIXME: Check for valid handle before dereferencing field or log error?
  */
@@ -250,8 +253,8 @@
 	struct pv_list *pvl;
 	int r = 0, consistent = 0;
 
-	if (!(vg = vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) {
-		log_error("get_pv_from_vg_by_id: vg_read_internal failed to read VG %s",
+	if (!(vg = _vg_read_internal(fmt->cmd, vg_name, vgid, &consistent))) {
+		log_error("get_pv_from_vg_by_id: _vg_read_internal failed to read VG %s",
 			  vg_name);
 		return 0;
 	}
@@ -623,7 +626,7 @@
 	/* FIXME: Is this vg_read_internal necessary? Move it inside
 	   vg_lock_newname? */
 	/* is this vg name already in use ? */
-	if ((vg = vg_read_internal(cmd, vg_name, NULL, &consistent))) {
+	if ((vg = _vg_read_internal(cmd, vg_name, NULL, &consistent))) {
 		log_error("A volume group called '%s' already exists.", vg_name);
 		unlock_and_release_vg(cmd, vg, vg_name);
 		return _vg_make_handle(cmd, NULL, FAILED_EXIST);
@@ -2039,7 +2042,7 @@
 
 	if (is_orphan_vg(vgname)) {
 		if (use_precommitted) {
-			log_error("Internal error: vg_read_internal requires vgname "
+			log_error("Internal error: _vg_read_internal requires vgname "
 				  "with pre-commit.");
 			return NULL;
 		}
@@ -2328,8 +2331,9 @@
 	return correct_vg;
 }
 
-struct volume_group *vg_read_internal(struct cmd_context *cmd, const char *vgname,
-			     const char *vgid, int *consistent)
+static struct volume_group *_vg_read_internal(struct cmd_context *cmd,
+					      const char *vgname,
+					      const char *vgid, int *consistent)
 {
 	struct volume_group *vg;
 	struct lv_list *lvl;
@@ -2370,7 +2374,7 @@
 
 /* This is only called by lv_from_lvid, which is only called from
  * activate.c so we know the appropriate VG lock is already held and
- * the vg_read_internal is therefore safe.
+ * the _vg_read_internal is therefore safe.
  */
 static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
 					    const char *vgid,
@@ -2403,7 +2407,7 @@
 	if (memlock())
 		goto out;
 
-	/* FIXME Need a genuine read by ID here - don't vg_read_internal by name! */
+	/* FIXME Need a genuine read by ID here - don't _vg_read_internal by name! */
 	/* FIXME Disabled vgrenames while active for now because we aren't
 	 *       allowed to do a full scan here any more. */
 
@@ -2594,7 +2598,7 @@
 			stack;
 			continue;
 		}
-		if (!(vg = vg_read_internal(cmd, vgname, vgid, &consistent))) {
+		if (!(vg = _vg_read_internal(cmd, vgname, vgid, &consistent))) {
 			stack;
 			continue;
 		}
@@ -2852,7 +2856,7 @@
 	if (!lock_vol(cmd, lock_name, lock_flags))
 		return_NULL;
 
-	if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent)))
+	if (!(vg = _vg_read_internal(cmd, vg_name, vgid, &consistent)))
 		return_NULL;
 
 	if (!consistent) {
@@ -2909,7 +2913,7 @@
 	consistent_in = consistent;
 
 	/* If consistent == 1, we get NULL here if correction fails. */
-	if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent))) {
+	if (!(vg = _vg_read_internal(cmd, vg_name, vgid, &consistent))) {
 		if (consistent_in && !consistent) {
 			log_error("Volume group \"%s\" inconsistent.", vg_name);
 			failure |= FAILED_INCONSISTENT;


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-07-10 21:19 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2009-07-10 21:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-07-10 21:19:37

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

Log message:
	Remove unused code vg_lock_and_read() and related flags.
	
	Author: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.89&r2=1.90
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.245&r2=1.246

--- LVM2/lib/metadata/metadata-exported.h	2009/07/10 20:07:02	1.89
+++ LVM2/lib/metadata/metadata-exported.h	2009/07/10 21:19:37	1.90
@@ -96,10 +96,6 @@
 #define FMT_UNLIMITED_STRIPESIZE 0x00000100U	/* Unlimited stripe size? */
 #define FMT_RESTRICTED_READAHEAD 0x00000200U	/* Readahead restricted to 2-120? */
 
-/* LVM2 external library flags */
-#define CORRECT_INCONSISTENT    0x00000001U /* Correct inconsistent metadata */
-#define FAIL_INCONSISTENT       0x00000002U /* Fail if metadata inconsistent */
-
 /* Mirror conversion type flags */
 #define MIRROR_BY_SEG		0x00000001U	/* segment-by-segment mirror */
 #define MIRROR_BY_LV		0x00000002U	/* mirror using whole mimage LVs */
@@ -384,10 +380,6 @@
 int vgs_are_compatible(struct cmd_context *cmd,
 		       struct volume_group *vg_from,
 		       struct volume_group *vg_to);
-vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
-		       const char *vgid,
-		       uint32_t lock_flags, uint32_t status_flags,
-		       uint32_t misc_flags);
 uint32_t vg_lock_newname(struct cmd_context *cmd, const char *vgname);
 
 /*
--- LVM2/lib/metadata/metadata.c	2009/07/10 20:09:21	1.245
+++ LVM2/lib/metadata/metadata.c	2009/07/10 21:19:37	1.246
@@ -2732,50 +2732,6 @@
 }
 
 /*
- * vg_lock_and_read - consolidate vg locking, reading, and status flag checking
- *
- * Returns:
- * NULL - failure
- * non-NULL - success; volume group handle
- */
-vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
-		       const char *vgid,
-		       uint32_t lock_flags, uint32_t status_flags,
-		       uint32_t misc_flags)
-{
-	struct volume_group *vg;
-	int consistent = 1;
-
-	if (!(misc_flags & CORRECT_INCONSISTENT))
-		consistent = 0;
-
-	if (!validate_name(vg_name)) {
-		log_error("Volume group name %s has invalid characters",
-			  vg_name);
-		return NULL;
-	}
-
-	if (!lock_vol(cmd, vg_name, lock_flags)) {
-		log_error("Can't get lock for %s", vg_name);
-		return NULL;
-	}
-
-	if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent)) ||
-	    ((misc_flags & FAIL_INCONSISTENT) && !consistent)) {
-		log_error("Volume group \"%s\" not found", vg_name);
-		unlock_and_release_vg(cmd, vg, vg_name);
-		return NULL;
-	}
-
-	if (!vg_check_status(vg, status_flags)) {
-		unlock_and_release_vg(cmd, vg, vg_name);
-		return NULL;
-	}
-
-	return vg;
-}
-
-/*
  * Create a (vg_t) volume group handle from a struct volume_group pointer and a
  * possible failure code or zero for success.
  */


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-07-08 14:31 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2009-07-08 14:31 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-07-08 14:31:17

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

Log message:
	Remove READ_CHECK_EXISTENCE and vg_might_exist().
	
	Remove READ_CHECK_EXISTENCE and vg_might_exist().
	This flag and API is no longer used now that we have a separate
	API to check for existence.
	
	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.79&r2=1.80
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.232&r2=1.233

--- LVM2/lib/metadata/metadata-exported.h	2009/07/08 14:28:30	1.79
+++ LVM2/lib/metadata/metadata-exported.h	2009/07/08 14:31:17	1.80
@@ -109,7 +109,6 @@
 #define READ_ALLOW_INCONSISTENT	0x00010000U
 #define READ_ALLOW_EXPORTED	0x00020000U
 #define READ_REQUIRE_RESIZEABLE	0x00040000U
-#define READ_CHECK_EXISTENCE	0x00080000U	/* Also used in vg->read_status */
 
 /* FIXME Deduce these next requirements internally instead of having caller specify. */
 #define LOCK_NONBLOCKING	0x00000100U	/* Fail if not available immediately. */
@@ -406,7 +405,6 @@
  * Test validity of a VG handle.
  */
 uint32_t vg_read_error(vg_t *vg_handle);
-uint32_t vg_might_exist(vg_t *vg_handle);
 
 /* pe_start and pe_end relate to any existing data so that new metadata
 * areas can avoid overlap */
--- LVM2/lib/metadata/metadata.c	2009/07/08 14:28:30	1.232
+++ LVM2/lib/metadata/metadata.c	2009/07/08 14:31:17	1.233
@@ -2754,9 +2754,6 @@
 	if (is_orphan_vg(vg_name))
 		status_flags &= ~LVM_WRITE;
 
-	if (misc_flags & READ_CHECK_EXISTENCE)
-		consistent = 0;
-
 	consistent_in = consistent;
 
 	/* If consistent == 1, we get NULL here if correction fails. */
@@ -2767,10 +2764,7 @@
 			goto_bad;
 		}
 
-		if (!(misc_flags & READ_CHECK_EXISTENCE))
-			log_error("Volume group \"%s\" not found", vg_name);
-		else
-			failure |= READ_CHECK_EXISTENCE;
+		log_error("Volume group \"%s\" not found", vg_name);
 
 		failure |= FAILED_NOTFOUND;
 		goto_bad;
@@ -2801,8 +2795,7 @@
 	return _vg_make_handle(cmd, vg, failure);
 
 bad:
-	if (failure != (FAILED_NOTFOUND | READ_CHECK_EXISTENCE) &&
-	    !already_locked)
+	if (!already_locked)
 		unlock_vg(cmd, lock_name);
 
 	return _vg_make_handle(cmd, vg, failure);
@@ -2821,7 +2814,6 @@
  *  - locking failed: FAILED_LOCKING
  *
  * On failures, all locks are released, unless one of the following applies:
- *  - failure == (FAILED_NOTFOUND | READ_CHECK_EXISTENCE)
  *  - vgname_is_locked(lock_name) is true
  * FIXME: remove the above 2 conditions if possible and make an error always
  * release the lock.
@@ -2830,12 +2822,6 @@
  *
  * Checking for VG existence:
  *
- * If READ_CHECK_EXISTENCE is set in flags, if the VG exists, a non-NULL struct
- * volume_group will be returned every time, but if it has INCONSISTENT_VG set,
- * the other fields will be uninitialized.  You must check for INCONSISTENT_VG
- * if passing READ_CHECK_EXISTENCE.  You also must not use it if it has
- * INCONSISTENT_VG set.
- *
  * FIXME: We want vg_read to attempt automatic recovery after acquiring a
  * temporary write lock: if that fails, we bail out as usual, with failed &
  * FAILED_INCONSISTENT. If it works, we are good to go. Code that's been in
@@ -2878,45 +2864,16 @@
 
 /*
  * Test the validity of a VG handle returned by vg_read() or vg_read_for_update().
- *
- * If READ_CHECK_EXISTENCE was supplied the non-existence of the volume group
- * is not considered an error.
- *
- * !vg_read_error() && vg_might_exist() => valid handle to VG.
- * vg_read_error() && vg_might_exist() => handle invalid, but VG might
- *					  exist but cannot be read.
- * !vg_read_error() && !vg_might_exist() => the VG does not exist
- * vg_read_error() && !vg_might_exist() is impossible.
  */
 uint32_t vg_read_error(vg_t *vg_handle)
 {
 	if (!vg_handle)
 		return FAILED_ALLOCATION;
 
-	if (vg_handle->read_status & READ_CHECK_EXISTENCE)
-		return vg_handle->read_status &
-		       ~(READ_CHECK_EXISTENCE | FAILED_NOTFOUND);
-
 	return vg_handle->read_status;
 }
 
 /*
- * Returns true if the volume group already exists.
- * If unsure, it will return true. It might exist but the read failed
- * for some other reason.
- */
-uint32_t vg_might_exist(vg_t *vg_handle)
-{
-	if (!vg_handle)
-		return 1;
-
-	if (vg_handle->read_status == (FAILED_NOTFOUND | READ_CHECK_EXISTENCE))
-		return 0;
-
-	return 1;
-}
-
-/*
  * Lock a vgname and/or check for existence.
  * Takes a WRITE lock on the vgname before scanning.
  * If scanning fails or vgname found, release the lock.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-07-08 14:28 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2009-07-08 14:28 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-07-08 14:28:30

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

Log message:
	Remove unneeded LOCK_KEEP from vg_read() interface.
	
	Remove unneeded LOCK_KEEP from vg_read() interface.
	Update comment to clarify cases where _vg_lock_and_read() may return
	with an error but the lock held.  Would be nice to make the vg_read()
	interface consistent with regards to lock held and error behavior.
	
	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.78&r2=1.79
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.231&r2=1.232

--- LVM2/lib/metadata/metadata-exported.h	2009/07/01 17:00:50	1.78
+++ LVM2/lib/metadata/metadata-exported.h	2009/07/08 14:28:30	1.79
@@ -113,7 +113,6 @@
 
 /* FIXME Deduce these next requirements internally instead of having caller specify. */
 #define LOCK_NONBLOCKING	0x00000100U	/* Fail if not available immediately. */
-#define LOCK_KEEP		0x00000200U	/* Do not unlock upon read failure. */
 
 /* A meta-flag, useful with toollib for_each_* functions. */
 #define READ_FOR_UPDATE 	0x00100000U
--- LVM2/lib/metadata/metadata.c	2009/07/06 19:04:25	1.231
+++ LVM2/lib/metadata/metadata.c	2009/07/08 14:28:30	1.232
@@ -2793,7 +2793,6 @@
 			goto_bad;
 		}
 	}
-	
 
 	failure |= _vg_bad_status_bits(vg, status_flags);
 	if (failure)
@@ -2803,7 +2802,7 @@
 
 bad:
 	if (failure != (FAILED_NOTFOUND | READ_CHECK_EXISTENCE) &&
-	    !(misc_flags & LOCK_KEEP) && !already_locked)
+	    !already_locked)
 		unlock_vg(cmd, lock_name);
 
 	return _vg_make_handle(cmd, vg, failure);
@@ -2821,7 +2820,11 @@
  *    FAILED_RESIZEABLE
  *  - locking failed: FAILED_LOCKING
  *
- * On failures, all locks are released, unless LOCK_KEEP has been supplied.
+ * On failures, all locks are released, unless one of the following applies:
+ *  - failure == (FAILED_NOTFOUND | READ_CHECK_EXISTENCE)
+ *  - vgname_is_locked(lock_name) is true
+ * FIXME: remove the above 2 conditions if possible and make an error always
+ * release the lock.
  *
  * Volume groups are opened read-only unless flags contains READ_FOR_UPDATE.
  *


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-06-09 14:29 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2009-06-09 14:29 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-06-09 14:29:11

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

Log message:
	Add vg_lock_newname() library function.
	
	Various tools need to check for existence of a VG before doing something
	(vgsplit, vgrename, vgcreate).  Currently we don't have an interface to
	check for existence, but the existence check is part of the vg_read* call(s).
	This patch is an attempt to pull out some of that functionality into a
	separate function, and hopefully simplify our vg_read interface, and
	move those patches along.
	
	vg_lock_newname() is only concerned about checking whether a vg exists in
	the system.  Unfortunately, we cannot just scan the system, but we must first
	obtain a lock.  Since we are reserving a vgname, we take a WRITE lock on
	the vgname.  Once obtained, we scan the system to ensure the name does
	not exist.  The return codes and behavior is in the function header.
	You might think of this function as similar to an open() call with
	O_CREAT and O_EXCL flags (returns failure with -EEXIST if file already
	exists).
	
	NOTE: I think including the word "lock" in the function name is important,
	as it clearly states the function obtains a lock and makes the code more
	readable, especially when it comes to cleanup / unlocking.  The ultimate
	function name is somewhat open for debate though so later we may rename.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.76&r2=1.77
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.224&r2=1.225

--- LVM2/lib/metadata/metadata-exported.h	2009/06/05 20:00:52	1.76
+++ LVM2/lib/metadata/metadata-exported.h	2009/06/09 14:29:10	1.77
@@ -127,6 +127,8 @@
 #define FAILED_RESIZEABLE	0x00000020U
 #define FAILED_CLUSTERED	0x00000040U
 #define FAILED_ALLOCATION	0x00000080U
+#define FAILED_EXIST		0x00000100U
+#define SUCCESS			0x00000000U
 
 /* Ordered list - see lv_manip.c */
 typedef enum {
@@ -401,6 +403,7 @@
 		       const char *vgid,
 		       uint32_t lock_flags, uint32_t status_flags,
 		       uint32_t misc_flags);
+uint32_t vg_lock_newname(struct cmd_context *cmd, const char *vgname);
 
 /*
  * Return a handle to VG metadata.
--- LVM2/lib/metadata/metadata.c	2009/06/01 12:43:32	1.224
+++ LVM2/lib/metadata/metadata.c	2009/06/09 14:29:10	1.225
@@ -2909,6 +2909,52 @@
 }
 
 /*
+ * Lock a vgname and/or check for existence.
+ * Takes a WRITE lock on the vgname before scanning.
+ * If scanning fails or vgname found, release the lock.
+ * NOTE: If you find the return codes confusing, you might think of this
+ * function as similar to an open() call with O_CREAT and O_EXCL flags
+ * (open returns fail with -EEXIST if file already exists).
+ *
+ * Returns:
+ * FAILED_LOCKING - Cannot lock name
+ * FAILED_EXIST - VG name already exists - cannot reserve
+ * SUCCESS - VG name does not exist in system and WRITE lock held
+ */
+uint32_t vg_lock_newname(struct cmd_context *cmd, const char *vgname)
+{
+	if (!lock_vol(cmd, vgname, LCK_VG_WRITE)) {
+		return FAILED_LOCKING;
+	}
+
+	/* Find the vgname in the cache */
+	/* If it's not there we must do full scan to be completely sure */
+	if (!fmt_from_vgname(vgname, NULL)) {
+		lvmcache_label_scan(cmd, 0);
+		if (!fmt_from_vgname(vgname, NULL)) {
+			if (memlock()) {
+				/*
+				 * FIXME: Disallow calling this function if
+				 * memlock() is true.
+				 */
+				unlock_vg(cmd, vgname);
+				return FAILED_LOCKING;
+			}
+			lvmcache_label_scan(cmd, 2);
+			if (!fmt_from_vgname(vgname, NULL)) {
+				/* vgname not found after scanning */
+				return SUCCESS;
+			}
+		}
+	}
+
+	/* Found vgname, cannot reserve */
+	unlock_vg(cmd, vgname);
+	return FAILED_EXIST;
+}
+
+
+/*
  * Gets/Sets for external LVM library
  */
 struct id pv_id(const pv_t *pv)


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-01-27  1:48 agk
  0 siblings, 0 replies; 16+ messages in thread
From: agk @ 2009-01-27  1:48 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2009-01-27 01:48:48

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

Log message:
	Add as-yet-unused vg_read_error() and vg_might_exist().  (mornfall)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.59&r2=1.60
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.201&r2=1.202

--- LVM2/lib/metadata/metadata-exported.h	2009/01/27 00:40:44	1.59
+++ LVM2/lib/metadata/metadata-exported.h	2009/01/27 01:48:47	1.60
@@ -387,12 +387,20 @@
 		       uint32_t lock_flags, uint32_t status_flags,
 		       uint32_t misc_flags);
 
-/* Loading volume group metadata. */
+/*
+ * Return a handle to VG metadata.
+ */
 vg_t *vg_read(struct cmd_context *cmd, const char *vg_name,
               const char *vgid, uint32_t flags);
 vg_t *vg_read_for_update(struct cmd_context *cmd, const char *vg_name,
                          const char *vgid, uint32_t flags);
 
+/* 
+ * Test validity of a VG handle.
+ */
+uint32_t vg_read_error(vg_t *vg_handle);
+uint32_t vg_might_exist(vg_t *vg_handle);
+
 /* pe_start and pe_end relate to any existing data so that new metadata
 * areas can avoid overlap */
 pv_t *pv_create(const struct cmd_context *cmd,
--- LVM2/lib/metadata/metadata.c	2009/01/27 00:40:44	1.201
+++ LVM2/lib/metadata/metadata.c	2009/01/27 01:48:47	1.202
@@ -2674,6 +2674,46 @@
 }
 
 /*
+ * Test the validity of a VG handle returned by vg_read() or vg_read_for_update().
+ *
+ * If READ_CHECK_EXISTENCE was supplied the non-existence of the volume group
+ * is not considered an error.
+ *
+ * !vg_read_error() && vg_might_exist() => valid handle to VG.
+ * vg_read_error() && vg_might_exist() => handle invalid, but VG might
+ *					  exist but cannot be read.
+ * !vg_read_error() && !vg_might_exist() => the VG does not exist
+ * vg_read_error() && !vg_might_exist() is impossible.
+ */
+uint32_t vg_read_error(vg_t *vg_handle)
+{
+	if (!vg_handle)
+		return FAILED_ALLOCATION;
+
+	if (vg_handle->read_status & READ_CHECK_EXISTENCE)
+		return vg_handle->read_status &
+		       ~(READ_CHECK_EXISTENCE | FAILED_NOTFOUND);
+
+	return vg_handle->read_status;
+}
+
+/*
+ * Returns true if the volume group already exists.
+ * If unsure, it will return true. It might exist but the read failed
+ * for some other reason.
+ */
+uint32_t vg_might_exist(vg_t *vg_handle)
+{
+	if (!vg_handle)
+		return 1;
+
+	if (vg_handle->read_status == (FAILED_NOTFOUND | READ_CHECK_EXISTENCE))
+		return 0;
+
+	return 1;
+}
+
+/*
  * Gets/Sets for external LVM library
  */
 struct id pv_id(const pv_t *pv)


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-01-27  0:40 agk
  0 siblings, 0 replies; 16+ messages in thread
From: agk @ 2009-01-27  0:40 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2009-01-27 00:40:45

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

Log message:
	Introduce as-yet-unused replacement vg_read() and vg_read_for_update()
	functions.  (mornfall)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.200&r2=1.201

--- LVM2/lib/metadata/metadata-exported.h	2009/01/26 22:13:22	1.58
+++ LVM2/lib/metadata/metadata-exported.h	2009/01/27 00:40:44	1.59
@@ -387,6 +387,12 @@
 		       uint32_t lock_flags, uint32_t status_flags,
 		       uint32_t misc_flags);
 
+/* Loading volume group metadata. */
+vg_t *vg_read(struct cmd_context *cmd, const char *vg_name,
+              const char *vgid, uint32_t flags);
+vg_t *vg_read_for_update(struct cmd_context *cmd, const char *vg_name,
+                         const char *vgid, uint32_t flags);
+
 /* pe_start and pe_end relate to any existing data so that new metadata
 * areas can avoid overlap */
 pv_t *pv_create(const struct cmd_context *cmd,
--- LVM2/lib/metadata/metadata.c	2009/01/26 22:43:00	1.200
+++ LVM2/lib/metadata/metadata.c	2009/01/27 00:40:44	1.201
@@ -2610,6 +2610,70 @@
 }
 
 /*
+ * vg_read: High-level volume group metadata read function.
+ *
+ * vg_read_error() must be used on any handle returned to check for errors.
+ *
+ *  - metadata inconsistent and automatic correction failed: FAILED_INCONSISTENT
+ *  - VG is read-only: FAILED_READ_ONLY
+ *  - VG is EXPORTED, unless flags has READ_ALLOW_EXPORTED: FAILED_EXPORTED
+ *  - VG is not RESIZEABLE, unless flags has ALLOW_NONRESIZEABLE:
+ *    FAILED_RESIZEABLE
+ *  - locking failed: FAILED_LOCKING
+ *
+ * On failures, all locks are released, unless LOCK_KEEP has been supplied.
+ *
+ * Volume groups are opened read-only unless flags contains READ_FOR_UPDATE.
+ *
+ * Checking for VG existence:
+ *
+ * If READ_CHECK_EXISTENCE is set in flags, if the VG exists, a non-NULL struct
+ * volume_group will be returned every time, but if it has INCONSISTENT_VG set,
+ * the other fields will be uninitialized.  You must check for INCONSISTENT_VG
+ * if passing READ_CHECK_EXISTENCE.  You also must not use it if it has
+ * INCONSISTENT_VG set.
+ *
+ * FIXME: We want vg_read to attempt automatic recovery after acquiring a
+ * temporary write lock: if that fails, we bail out as usual, with failed &
+ * FAILED_INCONSISTENT. If it works, we are good to go. Code that's been in
+ * toollib just set lock_flags to LCK_VG_WRITE and called vg_read_internal with
+ * *consistent = 1.
+ */
+vg_t *vg_read(struct cmd_context *cmd, const char *vg_name,
+	      const char *vgid, uint32_t flags)
+{
+	uint32_t status = CLUSTERED;
+	uint32_t lock_flags = LCK_VG_READ;
+
+	if (flags & READ_FOR_UPDATE) {
+		status |= EXPORTED_VG | LVM_WRITE;
+		lock_flags = LCK_VG_WRITE;
+	}
+
+	if (flags & READ_ALLOW_EXPORTED)
+		status &= ~EXPORTED_VG;
+
+	if (flags & READ_REQUIRE_RESIZEABLE)
+		status |= RESIZEABLE_VG;
+
+	if (flags & LOCK_NONBLOCKING)
+		lock_flags |= LCK_NONBLOCK;
+
+	return _vg_lock_and_read(cmd, vg_name, vgid, lock_flags, status, flags);
+}
+
+/*
+ * A high-level volume group metadata reading function. Open a volume group for
+ * later update (this means the user code can change the metadata and later
+ * request the new metadata to be written and committed).
+ */
+vg_t *vg_read_for_update(struct cmd_context *cmd, const char *vg_name,
+			 const char *vgid, uint32_t flags)
+{
+	return vg_read(cmd, vg_name, vgid, flags | READ_FOR_UPDATE);
+}
+
+/*
  * Gets/Sets for external LVM library
  */
 struct id pv_id(const pv_t *pv)


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2009-01-26 22:13 agk
  0 siblings, 0 replies; 16+ messages in thread
From: agk @ 2009-01-26 22:13 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2009-01-26 22:13:22

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

Log message:
	Introduce as-yet-unused _vg_lock_and_read() and associated header file
	definitions.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.57&r2=1.58
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.197&r2=1.198

--- LVM2/lib/metadata/metadata-exported.h	2009/01/26 19:01:32	1.57
+++ LVM2/lib/metadata/metadata-exported.h	2009/01/26 22:13:22	1.58
@@ -104,6 +104,29 @@
 #define MIRROR_BY_LV		0x00000002U	/* mirror using whole mimage LVs */
 #define MIRROR_SKIP_INIT_SYNC	0x00000010U	/* skip initial sync */
 
+/* vg_read and vg_read_for_update flags */
+#define READ_ALLOW_INCONSISTENT	0x00010000U
+#define READ_ALLOW_EXPORTED	0x00020000U
+#define READ_REQUIRE_RESIZEABLE	0x00040000U
+#define READ_CHECK_EXISTENCE	0x00080000U	/* Also used in vg->read_status */
+
+/* FIXME Deduce these next requirements internally instead of having caller specify. */
+#define LOCK_NONBLOCKING	0x00000100U	/* Fail if not available immediately. */
+#define LOCK_KEEP		0x00000200U	/* Do not unlock upon read failure. */
+
+/* A meta-flag, useful with toollib for_each_* functions. */
+#define READ_FOR_UPDATE 	0x00100000U
+
+/* vg's "read_status" field */
+#define FAILED_INCONSISTENT	0x00000001U
+#define FAILED_LOCKING		0x00000002U
+#define FAILED_NOTFOUND		0x00000004U
+#define FAILED_READ_ONLY	0x00000008U
+#define FAILED_EXPORTED		0x00000010U
+#define FAILED_RESIZEABLE	0x00000020U
+#define FAILED_CLUSTERED	0x00000040U
+#define FAILED_ALLOCATION	0x00000080U
+
 /* Ordered list - see lv_manip.c */
 typedef enum {
 	ALLOC_INVALID,
@@ -232,6 +255,17 @@
 	struct dm_list lvs;
 
 	struct dm_list tags;
+
+	/*
+	 * vg_t handle fields.
+	 * FIXME: Split these out.
+	 */
+
+	/*
+	 * Store result of the last vg_read().
+	 * 0 for success else appropriate FAILURE_* bits set.
+	 */
+	uint32_t read_status;
 };
 
 /* There will be one area for each stripe */
--- LVM2/lib/metadata/metadata.c	2009/01/26 19:01:32	1.197
+++ LVM2/lib/metadata/metadata.c	2009/01/26 22:13:22	1.198
@@ -2377,7 +2377,38 @@
 	return 1;
 }
 
+static uint32_t _vg_check_status(const struct volume_group *vg, uint32_t status)
+{
+	uint32_t failure = 0;
+
+	if ((status & CLUSTERED) &&
+	    (vg_is_clustered(vg)) && !locking_is_clustered() &&
+	    !lockingfailed()) {
+		log_error("Skipping clustered volume group %s", vg->name);
+		/* Return because other flags are considered undefined. */
+		return FAILED_CLUSTERED;
+	}
+
+	if ((status & EXPORTED_VG) &&
+	    (vg->status & EXPORTED_VG)) {
+		log_error("Volume group %s is exported", vg->name);
+		failure |= FAILED_EXPORTED;
+	}
 
+	if ((status & LVM_WRITE) &&
+	    !(vg->status & LVM_WRITE)) {
+		log_error("Volume group %s is read-only", vg->name);
+		failure |= FAILED_READ_ONLY;
+	}
+
+	if ((status & RESIZEABLE_VG) &&
+	    !(vg->status & RESIZEABLE_VG)) {
+		log_error("Volume group %s is not resizeable.", vg->name);
+		failure |= FAILED_RESIZEABLE;
+	}
+
+	return failure;
+}
 
 /**
  * vg_check_status - check volume group status flags and log error
@@ -2462,6 +2493,138 @@
 }
 
 /*
+ * Create a (vg_t) volume group handle from a struct volume_group pointer and a
+ * possible failure code or zero for success.
+ */
+static vg_t *_vg_make_handle(struct cmd_context *cmd,
+			     struct volume_group *vg,
+			     uint32_t failure)
+{
+	if (!vg && !(vg = dm_pool_zalloc(cmd->mem, sizeof(*vg)))) {
+		log_error("Error allocating vg handle.");
+		return_NULL;
+	}
+
+	vg->read_status = failure;
+
+	return (vg_t *)vg;
+}
+
+static vg_t *_recover_vg(struct cmd_context *cmd, const char *lock_name,
+			 const char *vg_name, const char *vgid,
+			 uint32_t lock_flags)
+{
+	int consistent = 1;
+	struct volume_group *vg;
+
+	lock_flags &= ~LCK_TYPE_MASK;
+	lock_flags |= LCK_WRITE;
+
+	unlock_vg(cmd, lock_name);
+
+	dev_close_all();
+
+	if (!lock_vol(cmd, lock_name, lock_flags))
+		return_NULL;
+
+	if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent)))
+		return_NULL;
+
+	if (!consistent)
+		return_NULL;
+
+	return (vg_t *)vg;
+}
+
+/*
+ * Consolidated locking, reading, and status flag checking.
+ *
+ * If the metadata is inconsistent, setting READ_ALLOW_INCONSISTENT in
+ * misc_flags will return it with FAILED_INCONSISTENT set instead of 
+ * giving you nothing.
+ *
+ * Use vg_read_error(vg) to determine the result.  Nonzero means there were
+ * problems reading the volume group.
+ * Zero value means that the VG is open and appropriate locks are held.
+ */
+static vg_t *_vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
+			       const char *vgid, uint32_t lock_flags,
+			       uint32_t status_flags, uint32_t misc_flags)
+{
+	struct volume_group *vg = 0;
+	const char *lock_name;
+ 	int consistent = 1;
+	int consistent_in;
+	uint32_t failure = 0;
+	int already_locked;
+
+	if (misc_flags & READ_ALLOW_INCONSISTENT || !(lock_flags & LCK_WRITE))
+		consistent = 0;
+
+	if (!validate_name(vg_name) && !is_orphan_vg(vg_name)) {
+		log_error("Volume group name %s has invalid characters",
+			  vg_name);
+		return NULL;
+	}
+
+	lock_name = is_orphan_vg(vg_name) ? VG_ORPHANS : vg_name;
+	already_locked = vgname_is_locked(lock_name);
+
+	if (!already_locked && !lock_vol(cmd, lock_name, lock_flags)) {
+		log_error("Can't get lock for %s", vg_name);
+		return _vg_make_handle(cmd, vg, FAILED_LOCKING);
+	}
+
+	if (is_orphan_vg(vg_name))
+		status_flags &= ~LVM_WRITE;
+
+	if (misc_flags & READ_CHECK_EXISTENCE)
+		consistent = 0;
+
+	consistent_in = consistent;
+
+	/* If consistent == 1, we get NULL here if correction fails. */
+	if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent))) {
+		if (consistent_in && !consistent) {
+			log_error("Volume group \"%s\" inconsistent.", vg_name);
+			failure |= FAILED_INCONSISTENT;
+			goto_bad;
+		}
+
+		if (!(misc_flags & READ_CHECK_EXISTENCE))
+			log_error("Volume group \"%s\" not found", vg_name);
+		else
+			failure |= READ_CHECK_EXISTENCE;
+
+		failure |= FAILED_NOTFOUND;
+		goto_bad;
+	}
+
+	/* consistent == 0 when VG is not found, but failed == FAILED_NOTFOUND */
+	if (!consistent && !failure)
+		if (!(vg = _recover_vg(cmd, lock_name, vg_name, vgid, lock_flags))) {
+			log_error("Recovery of volume group \"%s\" failed.",
+				  vg_name);
+			failure |= FAILED_INCONSISTENT;
+			goto_bad;
+		}
+	
+
+	failure |= _vg_check_status(vg, status_flags);
+	if (failure)
+		goto_bad;
+
+	return _vg_make_handle(cmd, vg, failure);
+
+bad:
+	if (failure != (FAILED_NOTFOUND | READ_CHECK_EXISTENCE) &&
+	    !(misc_flags & LOCK_KEEP) && !already_locked)
+		unlock_vg(cmd, lock_name);
+
+	return _vg_make_handle(cmd, vg, failure);
+}
+
+/*
  * Gets/Sets for external LVM library
  */
 struct id pv_id(const pv_t *pv)


^ permalink raw reply	[flat|nested] 16+ messages in thread

* LVM2/lib/metadata metadata-exported.h metadata.c
@ 2008-03-13 22:51 wysochanski
  0 siblings, 0 replies; 16+ messages in thread
From: wysochanski @ 2008-03-13 22:51 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-03-13 22:51:27

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

Log message:
	Const cleanups in find_* functions.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.158&r2=1.159

--- LVM2/lib/metadata/metadata-exported.h	2008/02/13 20:01:48	1.44
+++ LVM2/lib/metadata/metadata-exported.h	2008/03/13 22:51:24	1.45
@@ -428,14 +428,18 @@
 					   const char *layer_suffix);
 
 /* Find a PV within a given VG */
-struct pv_list *find_pv_in_vg(struct volume_group *vg, const char *pv_name);
-pv_t *find_pv_in_vg_by_uuid(struct volume_group *vg, struct id *id);
+struct pv_list *find_pv_in_vg(const struct volume_group *vg,
+			      const char *pv_name);
+pv_t *find_pv_in_vg_by_uuid(const struct volume_group *vg,
+			    const struct id *id);
 
 /* Find an LV within a given VG */
-struct lv_list *find_lv_in_vg(struct volume_group *vg, const char *lv_name);
+struct lv_list *find_lv_in_vg(const struct volume_group *vg,
+			      const char *lv_name);
 
 /* FIXME Merge these functions with ones above */
-struct logical_volume *find_lv(struct volume_group *vg, const char *lv_name);
+struct logical_volume *find_lv(const struct volume_group *vg,
+			       const char *lv_name);
 struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
 					const char *pv_name);
 
--- LVM2/lib/metadata/metadata.c	2008/02/13 20:01:48	1.158
+++ LVM2/lib/metadata/metadata.c	2008/03/13 22:51:24	1.159
@@ -58,10 +58,11 @@
 static struct physical_volume *_find_pv_by_name(struct cmd_context *cmd,
 			 			const char *pv_name);
 
-static struct pv_list *_find_pv_in_vg(struct volume_group *vg, const char *pv_name);
+static struct pv_list *_find_pv_in_vg(const struct volume_group *vg,
+				      const char *pv_name);
 
-static struct physical_volume *_find_pv_in_vg_by_uuid(struct volume_group *vg,
-						      struct id *id);
+static struct physical_volume *_find_pv_in_vg_by_uuid(const struct volume_group *vg,
+						      const struct id *id);
 
 unsigned long pe_align(void)
 {
@@ -851,12 +852,14 @@
 }
 
 /* FIXME: liblvm todo - make into function that returns handle */
-struct pv_list *find_pv_in_vg(struct volume_group *vg, const char *pv_name)
+struct pv_list *find_pv_in_vg(const struct volume_group *vg,
+			      const char *pv_name)
 {
 	return _find_pv_in_vg(vg, pv_name);
 }
 
-static struct pv_list *_find_pv_in_vg(struct volume_group *vg, const char *pv_name)
+static struct pv_list *_find_pv_in_vg(const struct volume_group *vg,
+				      const char *pv_name)
 {
 	struct pv_list *pvl;
 
@@ -890,14 +893,15 @@
  * Note
  *   FIXME - liblvm todo - make into function that takes VG handle
  */
-pv_t *find_pv_in_vg_by_uuid(struct volume_group *vg, struct id *id)
+pv_t *find_pv_in_vg_by_uuid(const struct volume_group *vg,
+			    const struct id *id)
 {
 	return _find_pv_in_vg_by_uuid(vg, id);
 }
 
 
-static struct physical_volume *_find_pv_in_vg_by_uuid(struct volume_group *vg,
-						      struct id *id)
+static struct physical_volume *_find_pv_in_vg_by_uuid(const struct volume_group *vg,
+						      const struct id *id)
 {
 	struct pv_list *pvl;
 
@@ -908,7 +912,8 @@
 	return NULL;
 }
 
-struct lv_list *find_lv_in_vg(struct volume_group *vg, const char *lv_name)
+struct lv_list *find_lv_in_vg(const struct volume_group *vg,
+			      const char *lv_name)
 {
 	struct lv_list *lvl;
 	const char *ptr;
@@ -938,7 +943,8 @@
 	return NULL;
 }
 
-struct logical_volume *find_lv(struct volume_group *vg, const char *lv_name)
+struct logical_volume *find_lv(const struct volume_group *vg,
+			       const char *lv_name)
 {
 	struct lv_list *lvl = find_lv_in_vg(vg, lv_name);
 	return lvl ? lvl->lv : NULL;


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-06-29 22:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-29 22:41 LVM2/lib/metadata metadata-exported.h metadata.c wysochanski
  -- strict thread matches above, loose matches on Subject: below --
2010-06-28 20:36 wysochanski
2010-05-19 11:52 wysochanski
2010-04-13 17:26 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

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).