public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/form ...
@ 2011-09-01 10:25 zkabelac
  0 siblings, 0 replies; 4+ messages in thread
From: zkabelac @ 2011-09-01 10:25 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-09-01 10:25:23

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/format_text: export.c import-export.h 
	lib/metadata   : metadata.h 

Log message:
	Use size_t return type
	
	Since these function returns buffer size - use size_t type for them.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2087&r2=1.2088
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.117&r2=1.118
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/export.c.diff?cvsroot=lvm2&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import-export.h.diff?cvsroot=lvm2&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.250&r2=1.251

--- LVM2/WHATS_NEW	2011/08/31 12:47:59	1.2087
+++ LVM2/WHATS_NEW	2011/09/01 10:25:22	1.2088
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Use size_t return type for text_vg_export_raw() and export_vg_to_buffer().
   Add configure --enable-lvmetad for building the (experimental) LVMetaD.
   Fix resource leak when strdup fails in _get_device_status() (2.02.85).
   Directly allocate buffer memory in a pvck scan instead of using a mempool.
--- LVM2/lib/cache/lvmcache.c	2011/08/30 14:55:16	1.117
+++ LVM2/lib/cache/lvmcache.c	2011/09/01 10:25:22	1.118
@@ -102,7 +102,7 @@
 	char uuid[64] __attribute__((aligned(8)));
 	struct lvmcache_vginfo *vginfo;
 	char *data;
-	int size;
+	size_t size;
 
 	if (!(vginfo = vginfo_from_vgid((const char *)&vg->id))) {
 		stack;
@@ -132,7 +132,7 @@
 		return;
 	}
 
-	log_debug("Metadata cache: VG %s (%s) stored (%d bytes%s).",
+	log_debug("Metadata cache: VG %s (%s) stored (%" PRIsize_t " bytes%s).",
 		  vginfo->vgname, uuid, size,
 		  precommitted ? ", precommitted" : "");
 }
--- LVM2/lib/format_text/export.c	2011/08/30 14:55:17	1.83
+++ LVM2/lib/format_text/export.c	2011/09/01 10:25:22	1.84
@@ -775,10 +775,10 @@
 }
 
 /* Returns amount of buffer used incl. terminating NUL */
-int text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf)
+size_t text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf)
 {
 	struct formatter *f;
-	int r = 0;
+	size_t r = 0;
 
 	_init();
 
@@ -809,7 +809,7 @@
 	return r;
 }
 
-int export_vg_to_buffer(struct volume_group *vg, char **buf)
+size_t export_vg_to_buffer(struct volume_group *vg, char **buf)
 {
 	return text_vg_export_raw(vg, "", buf);
 }
--- LVM2/lib/format_text/import-export.h	2011/08/30 14:55:17	1.27
+++ LVM2/lib/format_text/import-export.h	2011/09/01 10:25:22	1.28
@@ -65,7 +65,7 @@
 int read_tags(struct dm_pool *mem, struct dm_list *tags, const struct dm_config_value *cv);
 
 int text_vg_export_file(struct volume_group *vg, const char *desc, FILE *fp);
-int text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf);
+size_t text_vg_export_raw(struct volume_group *vg, const char *desc, char **buf);
 struct volume_group *text_vg_import_file(struct format_instance *fid,
 					 const char *file,
 					 time_t *when, char **desc);
--- LVM2/lib/metadata/metadata.h	2011/08/30 14:55:17	1.250
+++ LVM2/lib/metadata/metadata.h	2011/09/01 10:25:22	1.251
@@ -454,7 +454,7 @@
 /*
  * For internal metadata caching.
  */
-int export_vg_to_buffer(struct volume_group *vg, char **buf);
+size_t export_vg_to_buffer(struct volume_group *vg, char **buf);
 int export_vg_to_config_tree(struct volume_group *vg, struct dm_config_tree **cft);
 struct volume_group *import_vg_from_buffer(const char *buf,
 					   struct format_instance *fid);


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

* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/form ...
@ 2007-11-02 13:06 bmr
  0 siblings, 0 replies; 4+ messages in thread
From: bmr @ 2007-11-02 13:06 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	bmr@sourceware.org	2007-11-02 13:06:42

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/format1    : disk-rep.c 
	lib/format_text: format-text.c 
	lib/locking    : locking.c 
	lib/metadata   : metadata-exported.h metadata.c metadata.h 
	                 pv_manip.c 
	tools          : toollib.c vgrename.c 

Log message:
	Add is_orphan_vg() and change all hardcoded checks to use it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.722&r2=1.723
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/disk-rep.c.diff?cvsroot=lvm2&r1=1.68&r2=1.69
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.140&r2=1.141
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.172&r2=1.173
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/pv_manip.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.108&r2=1.109
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47

--- LVM2/WHATS_NEW	2007/10/24 00:51:05	1.722
+++ LVM2/WHATS_NEW	2007/11/02 13:06:41	1.723
@@ -1,5 +1,6 @@
 Version 2.02.29 -
 ==================================
+  Add is_orphan_vg() and change all hardcoded checks to use it.
   Detect md superblocks version 1.0, 1.1 and 1.2.
   Add _alloc_pv() and _free_pv() from _pv_create() code and fix error paths.
   Add pv_dev_name() to access PV device name.
--- LVM2/lib/cache/lvmcache.c	2007/08/20 20:55:24	1.31
+++ LVM2/lib/cache/lvmcache.c	2007/11/02 13:06:41	1.32
@@ -633,7 +633,7 @@
 			return 0;
 		}
 		/* Ensure orphans appear last on list_iterate */
-		if (!*vgname)
+		if (is_orphan_vg(vgname))
 			list_add(&_vginfos, &vginfo->list);
 		else
 			list_add_h(&_vginfos, &vginfo->list);
@@ -649,7 +649,7 @@
 	vginfo->fmt = info->fmt;
 
 	log_debug("lvmcache: %s: now %s%s%s%s%s", dev_name(info->dev),
-		  *vgname ? "in VG " : "orphaned", vgname,
+		  is_orphan_vg(vgname) ? "in VG " : "orphaned", vgname,
 		  vginfo->vgid[0] ? " (" : "",
 		  vginfo->vgid[0] ? vginfo->vgid : "",
 		  vginfo->vgid[0] ? ")" : "");
--- LVM2/lib/format1/disk-rep.c	2007/08/22 14:38:16	1.68
+++ LVM2/lib/format1/disk-rep.c	2007/11/02 13:06:41	1.69
@@ -480,7 +480,7 @@
 		}
 
 		/* Did we find the whole VG? */
-		if (!vg_name || !*vg_name ||
+		if (!vg_name || is_orphan_vg(vg_name) ||
 		    (data && *data->pvd.vg_name &&
 		     list_size(head) == data->vgd.pv_cur))
 			return 1;
--- LVM2/lib/format_text/format-text.c	2007/10/12 14:29:32	1.83
+++ LVM2/lib/format_text/format-text.c	2007/11/02 13:06:41	1.84
@@ -1438,7 +1438,8 @@
 	info = (struct lvmcache_info *) label->info;
 
 	/* Have we already cached vgname? */
-	if (info->vginfo && info->vginfo->vgname && *info->vginfo->vgname &&
+	if (info->vginfo && info->vginfo->vgname &&
+	    !is_orphan_vg(info->vginfo->vgname) &&
 	    get_pv_from_vg_by_id(info->fmt, info->vginfo->vgname,
 				 info->vginfo->vgid, info->dev->pvid, pv)) {
 		return 1;
@@ -1449,7 +1450,7 @@
 		lvmcache_label_scan(fmt->cmd, 2);
 
 		if (info->vginfo && info->vginfo->vgname &&
-		    *info->vginfo->vgname &&
+		    !is_orphan_vg(info->vginfo->vgname) &&
 		    get_pv_from_vg_by_id(info->fmt, info->vginfo->vgname,
 					 info->vginfo->vgid,
 					 info->dev->pvid, pv)) {
--- LVM2/lib/locking/locking.c	2007/08/22 14:38:17	1.40
+++ LVM2/lib/locking/locking.c	2007/11/02 13:06:41	1.41
@@ -288,7 +288,7 @@
 	char path[PATH_MAX];
 
 	/* We'll allow operations on orphans */
-	if (!*vgname)
+	if (is_orphan_vg(vgname))
 		return 1;
 
 	if (dm_snprintf(path, sizeof(path), "%s/lvm/VGs/%s", cmd->proc_dir,
--- LVM2/lib/metadata/metadata-exported.h	2007/10/12 14:29:32	1.20
+++ LVM2/lib/metadata/metadata-exported.h	2007/11/02 13:06:41	1.21
@@ -304,6 +304,7 @@
 
 int pv_write(struct cmd_context *cmd, struct physical_volume *pv,
 	     struct list *mdas, int64_t label_sector);
+int is_orphan_vg(const char *vg_name);
 int is_orphan(pv_t *pv);
 vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name,
 		       uint32_t lock_flags, uint32_t status_flags,
--- LVM2/lib/metadata/metadata.c	2007/10/12 21:08:38	1.140
+++ LVM2/lib/metadata/metadata.c	2007/11/02 13:06:41	1.141
@@ -93,7 +93,7 @@
 		return 0;
 	}
 
-	if (*pv->vg_name) {
+	if (!is_orphan_vg(pv->vg_name)) {
 		log_error("Physical volume '%s' is already in volume group "
 			  "'%s'", pv_name, pv->vg_name);
 		return 0;
@@ -928,7 +928,7 @@
 	}
 
 	/* FIXME Can fail when no PV mda */
-	if (!pv->vg_name[0]) {
+	if (is_orphan_vg(pv->vg_name)) {
 		log_error("Physical volume %s not in a volume group", pv_name);
 		return NULL;
 	}
@@ -1272,7 +1272,7 @@
 	struct list all_pvs;
 	char uuid[64] __attribute((aligned(8)));
 
-	if (!*vgname) {
+	if (is_orphan_vg(vgname)) {
 		if (use_precommitted) {
 			log_error("Internal error: vg_read requires vgname "
 				  "with pre-commit.");
@@ -1536,7 +1536,7 @@
 
 	/* Is corresponding vgname already cached? */
 	if ((vginfo = vginfo_from_vgid(vgid)) &&
-	    vginfo->vgname && *vginfo->vgname) {
+	    vginfo->vgname && !is_orphan_vg(vginfo->vgname)) {
 		if ((vg = _vg_read(cmd, vginfo->vgname, vgid,
 				   &consistent, precommitted)) &&
 		    !strncmp((char *)vg->id.uuid, vgid, ID_LEN)) {
@@ -1566,7 +1566,7 @@
 
 	list_iterate_items(strl, vgnames) {
 		vgname = strl->str;
-		if (!vgname || !*vgname)
+		if (!vgname || is_orphan_vg(vgname))
 			continue;	// FIXME Unnecessary? 
 		consistent = 0;
 		if ((vg = _vg_read(cmd, vgname, vgid, &consistent,
@@ -1778,7 +1778,7 @@
 		return 0;
 	}
 
-	if (*pv->vg_name || pv->pe_alloc_count) {
+	if (!is_orphan_vg(pv->vg_name) || pv->pe_alloc_count) {
 		log_error("Assertion failed: can't _pv_write non-orphan PV "
 			  "(in VG %s)", pv->vg_name);
 		return 0;
@@ -1815,15 +1815,23 @@
 }
 
 /**
+ * is_orphan_vg - Determine whether a vg_name is an orphan
+ * @vg_name: pointer to the vg_name
+ */
+int is_orphan_vg(const char *vg_name)
+{
+	return (vg_name[0] ? 0 : 1);
+}
+
+/**
  * is_orphan - Determine whether a pv is an orphan based on its vg_name
  * @pv: handle to the physical volume
  */
 int is_orphan(pv_t *pv)
 {
-	return (pv_field(pv, vg_name)[0] ? 0 : 1);
+	return is_orphan_vg(pv_field(pv, vg_name));
 }
 
-
 /*
  * Returns:
  *  0 - fail
--- LVM2/lib/metadata/metadata.h	2007/10/12 14:08:10	1.172
+++ LVM2/lib/metadata/metadata.h	2007/11/02 13:06:41	1.173
@@ -180,7 +180,7 @@
 
 	/*
 	 * Write a PV structure to disk. Fails if the PV is in a VG ie
-	 * pv->vg_name must be null.
+	 * pv->vg_name must be a valid orphan VG name
 	 */
 	int (*pv_write) (const struct format_type * fmt,
 			 struct physical_volume * pv, struct list * mdas,
--- LVM2/lib/metadata/pv_manip.c	2007/10/12 14:29:32	1.15
+++ LVM2/lib/metadata/pv_manip.c	2007/11/02 13:06:41	1.16
@@ -455,7 +455,7 @@
 
 	list_init(&mdas);
 
-	if (!*pv_vg_name(pv)) {
+	if (is_orphan_vg(pv_vg_name(pv))) {
 		vg_name = ORPHAN;
 
 		if (!lock_vol(cmd, vg_name, LCK_VG_WRITE)) {
@@ -572,7 +572,7 @@
 		    pv_name, pv_size(pv));
 
 	log_verbose("Updating physical volume \"%s\"", pv_name);
-	if (*pv_vg_name(pv)) {
+	if (!is_orphan_vg(pv_vg_name(pv))) {
 		if (!vg_write(vg) || !vg_commit(vg)) {
 			unlock_vg(cmd, pv_vg_name(pv));
 			log_error("Failed to store physical volume \"%s\" in "
--- LVM2/tools/toollib.c	2007/10/12 14:29:32	1.108
+++ LVM2/tools/toollib.c	2007/11/02 13:06:42	1.109
@@ -341,7 +341,7 @@
 
 	list_iterate_items(strl, vgnames) {
 		vgname = strl->str;
-		if (!vgname || !*vgname)
+		if (!vgname || is_orphan_vg(vgname))
 			continue;	/* FIXME Unnecessary? */
 		if (!lock_vol(cmd, vgname, lock_type)) {
 			log_error("Can't lock %s: skipping", vgname);
@@ -576,7 +576,7 @@
 		list_iterate_items(sl, vgids) {
 			vgid = sl->str;
 			if (!vgid || !(vg_name = vgname_from_vgid(cmd->mem, vgid)) ||
-			    !*vg_name)
+			    is_orphan_vg(vg_name))
 				continue;
 			ret_max = _process_one_vg(cmd, vg_name, vgid, &tags,
 						  &arg_vgnames,
@@ -588,7 +588,7 @@
 	} else {
 		list_iterate_items(sl, vgnames) {
 			vg_name = sl->str;
-			if (!vg_name || !*vg_name)
+			if (!vg_name || is_orphan_vg(vg_name))
 				continue;	/* FIXME Unnecessary? */
 			ret_max = _process_one_vg(cmd, vg_name, NULL, &tags,
 						  &arg_vgnames,
@@ -1199,6 +1199,9 @@
 	if (!validate_name(vg_name))
 		return 0;
 
+	if (is_orphan_vg(vg_name))
+		return 0;
+
 	snprintf(vg_path, PATH_MAX, "%s%s", cmd->dev_dir, vg_name);
 	if (path_exists(vg_path)) {
 		log_error("%s: already exists in filesystem", vg_path);
--- LVM2/tools/vgrename.c	2007/08/31 19:09:49	1.46
+++ LVM2/tools/vgrename.c	2007/11/02 13:06:42	1.47
@@ -65,7 +65,8 @@
 
 	list_iterate_items(sl, vgids) {
 		vgid = sl->str;
-		if (!vgid || !(vg_name = vgname_from_vgid(NULL, vgid)) || !*vg_name)
+		if (!vgid || !(vg_name = vgname_from_vgid(NULL, vgid))
+					|| is_orphan_vg(vg_name))
 			continue;
 		if (!strcmp(vg_name, vg_name_old)) {
 			if (match) {


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

* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/form ...
@ 2007-04-23 18:21 wysochanski
  0 siblings, 0 replies; 4+ messages in thread
From: wysochanski @ 2007-04-23 18:21 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2007-04-23 19:21:01

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/format_text: format-text.c 
	lib/label      : label.c label.h 
	lib/metadata   : metadata.c 
	tools          : lvmdiskscan.c 

Log message:
	Add 'scan_sector' parameter to label_read and _find_labeller to add
	flexibility in searching for disk labels.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.598&r2=1.599
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/label/label.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/label/label.h.diff?cvsroot=lvm2&r1=1.18&r2=1.19
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.104&r2=1.105
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmdiskscan.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17

--- LVM2/WHATS_NEW	2007/04/23 14:55:28	1.598
+++ LVM2/WHATS_NEW	2007/04/23 18:21:01	1.599
@@ -1,5 +1,6 @@
 Version 2.02.25 -
 =================================
+  Add scan_sector param to label_read and _find_labeller.
   Make clvmd cope with quorum devices on RHEL5
   Add dev_read_circular.
   Add pvck command stub.
--- LVM2/lib/cache/lvmcache.c	2006/11/30 23:11:39	1.29
+++ LVM2/lib/cache/lvmcache.c	2007/04/23 18:21:01	1.30
@@ -135,7 +135,7 @@
 
 	list_iterate_safe(devh, tmp, &devs) {
 		devl = list_item(devh, struct device_list);
-		label_read(devl->dev, &label);
+		label_read(devl->dev, &label, UINT64_C(0));
 		list_del(&devl->list);
 		dm_free(devl);
 	}
@@ -205,7 +205,7 @@
 	struct label *label;
 
 	if (info->status & CACHE_INVALID)
-		label_read(info->dev, &label);
+		label_read(info->dev, &label, UINT64_C(0));
 }
 
 static int _scan_invalid(void)
@@ -247,7 +247,7 @@
 	}
 
 	while ((dev = dev_iter_get(iter)))
-		label_read(dev, &label);
+		label_read(dev, &label, UINT64_C(0));
 
 	dev_iter_destroy(iter);
 
@@ -346,7 +346,7 @@
 
 	/* Already cached ? */
 	if ((info = info_from_pvid((char *) pvid))) {
-		if (label_read(info->dev, &label)) {
+		if (label_read(info->dev, &label, UINT64_C(0))) {
 			info = (struct lvmcache_info *) label->info;
 			if (id_equal(pvid, (struct id *) &info->dev->pvid))
 				return info->dev;
@@ -357,7 +357,7 @@
 
 	/* Try again */
 	if ((info = info_from_pvid((char *) pvid))) {
-		if (label_read(info->dev, &label)) {
+		if (label_read(info->dev, &label, UINT64_C(0))) {
 			info = (struct lvmcache_info *) label->info;
 			if (id_equal(pvid, (struct id *) &info->dev->pvid))
 				return info->dev;
@@ -371,7 +371,7 @@
 
 	/* Try again */
 	if ((info = info_from_pvid((char *) pvid))) {
-		if (label_read(info->dev, &label)) {
+		if (label_read(info->dev, &label, UINT64_C(0))) {
 			info = (struct lvmcache_info *) label->info;
 			if (id_equal(pvid, (struct id *) &info->dev->pvid))
 				return info->dev;
--- LVM2/lib/format_text/format-text.c	2007/03/23 12:43:17	1.73
+++ LVM2/lib/format_text/format-text.c	2007/04/23 18:21:01	1.74
@@ -1287,7 +1287,7 @@
 	}
 
 	/* FIXME Optimise out repeated reading when cache lock held */
-	if (!(label_read(dev, &label))) {
+	if (!(label_read(dev, &label, UINT64_C(0)))) {
 		stack;
 		return 0;
 	}
--- LVM2/lib/label/label.c	2006/11/30 23:11:41	1.36
+++ LVM2/lib/label/label.c	2007/04/23 18:21:01	1.37
@@ -107,7 +107,8 @@
 }
 
 static struct labeller *_find_labeller(struct device *dev, char *buf,
-				       uint64_t *label_sector)
+				       uint64_t *label_sector,
+				       uint64_t scan_sector)
 {
 	struct labeller_i *li;
 	struct labeller *r = NULL;
@@ -117,12 +118,13 @@
 	int found = 0;
 	char readbuf[LABEL_SCAN_SIZE] __attribute((aligned(8)));
 
-	if (!dev_read(dev, UINT64_C(0), LABEL_SCAN_SIZE, readbuf)) {
+	if (!dev_read(dev, scan_sector << SECTOR_SHIFT,
+		      LABEL_SCAN_SIZE, readbuf)) {
 		log_debug("%s: Failed to read label area", dev_name(dev));
 		goto out;
 	}
 
-	/* Scan first few sectors for a valid label */
+	/* Scan a few sectors for a valid label */
 	for (sector = 0; sector < LABEL_SCAN_SECTORS;
 	     sector += LABEL_SIZE >> SECTOR_SHIFT) {
 		lh = (struct label_header *) (readbuf +
@@ -132,13 +134,14 @@
 			if (found) {
 				log_error("Ignoring additional label on %s at "
 					  "sector %" PRIu64, dev_name(dev),
-					  sector);
+					  sector + scan_sector);
 			}
-			if (xlate64(lh->sector_xl) != sector) {
+			if (xlate64(lh->sector_xl) != sector + scan_sector) {
 				log_info("%s: Label for sector %" PRIu64
 					 " found at sector %" PRIu64
 					 " - ignoring", dev_name(dev),
-					 xlate64(lh->sector_xl), sector);
+					 xlate64(lh->sector_xl),
+					 sector + scan_sector);
 				continue;
 			}
 			if (calc_crc(INITIAL_CRC, &lh->offset_xl, LABEL_SIZE -
@@ -153,19 +156,21 @@
 		}
 
 		list_iterate_items(li, &_labellers) {
-			if (li->l->ops->can_handle(li->l, (char *) lh, sector)) {
+			if (li->l->ops->can_handle(li->l, (char *) lh,
+						   sector + scan_sector)) {
 				log_very_verbose("%s: %s label detected",
 						 dev_name(dev), li->name);
 				if (found) {
 					log_error("Ignoring additional label "
 						  "on %s at sector %" PRIu64,
-						  dev_name(dev), sector);
+						  dev_name(dev),
+						  sector + scan_sector);
 					continue;
 				}
 				r = li->l;
 				memcpy(buf, lh, LABEL_SIZE);
 				if (label_sector)
-					*label_sector = sector;
+					*label_sector = sector + scan_sector;
 				found = 1;
 				break;
 			}
@@ -256,7 +261,8 @@
 }
 
 /* FIXME Avoid repeated re-reading if cache lock held */
-int label_read(struct device *dev, struct label **result)
+int label_read(struct device *dev, struct label **result,
+		uint64_t scan_sector)
 {
 	char buf[LABEL_SIZE] __attribute((aligned(8)));
 	struct labeller *l;
@@ -274,7 +280,7 @@
 		return r;
 	}
 
-	if (!(l = _find_labeller(dev, buf, &sector)))
+	if (!(l = _find_labeller(dev, buf, &sector, scan_sector)))
 		goto_out;
 
 	if ((r = (l->ops->read)(l, dev, buf, result)) && result && *result)
@@ -354,7 +360,7 @@
 		return_0;
 	}
 
-	if (!(l = _find_labeller(dev, buf, &sector)))
+	if (!(l = _find_labeller(dev, buf, &sector, UINT64_C(0))))
 		goto_out;
 
 	r = l->ops->verify ? l->ops->verify(l, buf, sector) : 1;
--- LVM2/lib/label/label.h	2006/11/30 23:11:41	1.18
+++ LVM2/lib/label/label.h	2007/04/23 18:21:01	1.19
@@ -96,7 +96,8 @@
 struct labeller *label_get_handler(const char *name);
 
 int label_remove(struct device *dev);
-int label_read(struct device *dev, struct label **result);
+int label_read(struct device *dev, struct label **result,
+		uint64_t scan_sector);
 int label_write(struct device *dev, struct label *label);
 int label_verify(struct device *dev);
 struct label *label_create(struct labeller *labeller);
--- LVM2/lib/metadata/metadata.c	2007/03/23 12:43:17	1.104
+++ LVM2/lib/metadata/metadata.c	2007/04/23 18:21:01	1.105
@@ -1403,7 +1403,7 @@
 		return NULL;
 	}
 
-	if (!(label_read(dev, &label))) {
+	if (!(label_read(dev, &label, UINT64_C(0)))) {
 		if (warnings)
 			log_error("No physical volume label read from %s",
 				  pv_name);
--- LVM2/tools/lvmdiskscan.c	2006/05/09 21:23:51	1.16
+++ LVM2/tools/lvmdiskscan.c	2007/04/23 18:21:01	1.17
@@ -112,7 +112,7 @@
 	/* Do scan */
 	for (dev = dev_iter_get(iter); dev; dev = dev_iter_get(iter)) {
 		/* Try if it is a PV first */
-		if ((label_read(dev, &label))) {
+		if ((label_read(dev, &label, UINT64_C(0)))) {
 			if (!dev_get_size(dev, &size)) {
 				log_error("Couldn't get size of \"%s\"",
 					  dev_name(dev));


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

* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/form ...
@ 2006-04-10 22:09 agk
  0 siblings, 0 replies; 4+ messages in thread
From: agk @ 2006-04-10 22:09 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-04-10 22:09:00

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/format1    : disk-rep.c disk-rep.h lvm1-label.c 
	lib/format_text: text_label.c 

Log message:
	Capture vgid in more places.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.355&r2=1.356
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/disk-rep.c.diff?cvsroot=lvm2&r1=1.56&r2=1.57
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/disk-rep.h.diff?cvsroot=lvm2&r1=1.43&r2=1.44
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/lvm1-label.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/text_label.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9


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

end of thread, other threads:[~2011-09-01 10:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-01 10:25 LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/form zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2007-11-02 13:06 bmr
2007-04-23 18:21 wysochanski
2006-04-10 22:09 agk

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