public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/format_text import_vsn1.c
@ 2012-01-19 15:17 zkabelac
  0 siblings, 0 replies; 7+ messages in thread
From: zkabelac @ 2012-01-19 15:17 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-01-19 15:17:46

Modified files:
	lib/format_text: import_vsn1.c 

Log message:
	Rename internal macro to match signess
	
	Since _read_int64 called dm_config_get_uint64, rename it to
	less confusing _read_uint64.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.96&r2=1.97

--- LVM2/lib/format_text/import_vsn1.c	2011/12/21 12:49:00	1.96
+++ LVM2/lib/format_text/import_vsn1.c	2012/01/19 15:17:46	1.97
@@ -39,7 +39,7 @@
 #define _read_uint32(root, path, result) \
 	dm_config_get_uint32(root, path, result)
 
-#define _read_int64(root, path, result) \
+#define _read_uint64(root, path, result) \
 	dm_config_get_uint64(root, path, result)
 
 /*
@@ -216,9 +216,9 @@
 		pv->status |= MISSING_PV;
 
 	/* Late addition */
-	_read_int64(pvn, "dev_size", &pv->size);
+	_read_uint64(pvn, "dev_size", &pv->size);
 
-	if (!_read_int64(pvn, "pe_start", &pv->pe_start)) {
+	if (!_read_uint64(pvn, "pe_start", &pv->pe_start)) {
 		log_error("Couldn't read extent size for physical volume.");
 		return 0;
 	}


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

* LVM2/lib/format_text import_vsn1.c
@ 2012-02-27 11:40 zkabelac
  0 siblings, 0 replies; 7+ messages in thread
From: zkabelac @ 2012-02-27 11:40 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2012-02-27 11:40:58

Modified files:
	lib/format_text: import_vsn1.c 

Log message:
	Just code move of hash initialization in front of function
	
	Make sure both hash tables are initialized before _read_sections() call.
	Presents no functional change (since PV scan phase was not adding LV hashes),
	but makes the code easier to handle mem failing case, and static analyzer is
	hapier as well.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102

--- LVM2/lib/format_text/import_vsn1.c	2012/02/23 13:11:09	1.101
+++ LVM2/lib/format_text/import_vsn1.c	2012/02/27 11:40:58	1.102
@@ -694,6 +694,24 @@
 	if (!(vg->system_id = dm_pool_zalloc(vg->vgmem, NAME_LEN + 1)))
 		goto_bad;
 
+	/*
+	 * The pv hash memorises the pv section names -> pv
+	 * structures.
+	 */
+	if (!(pv_hash = dm_hash_create(64))) {
+		log_error("Couldn't create pv hash table.");
+		goto bad;
+	}
+
+	/*
+	 * The lv hash memorises the lv section names -> lv
+	 * structures.
+	 */
+	if (!(lv_hash = dm_hash_create(1024))) {
+		log_error("Couldn't create lv hash table.");
+		goto bad;
+	}
+
 	vgn = vgn->child;
 
 	if (dm_config_get_str(vgn, "system_id", &str)) {
@@ -752,15 +770,6 @@
 		vg->mda_copies = DEFAULT_VGMETADATACOPIES;
 	}
 
-	/*
-	 * The pv hash memorises the pv section names -> pv
-	 * structures.
-	 */
-	if (!(pv_hash = dm_hash_create(64))) {
-		log_error("Couldn't create hash table.");
-		goto bad;
-	}
-
 	if (!_read_sections(fid, "physical_volumes", _read_pv, vg,
 			    vgn, pv_hash, lv_hash, 0, &scan_done_once)) {
 		log_error("Couldn't find all physical volumes for volume "
@@ -775,15 +784,6 @@
 		goto bad;
 	}
 
-	/*
-	 * The lv hash memorises the lv section names -> lv
-	 * structures.
-	 */
-	if (!(lv_hash = dm_hash_create(1024))) {
-		log_error("Couldn't create hash table.");
-		goto bad;
-	}
-
 	if (!_read_sections(fid, "logical_volumes", _read_lvnames, vg,
 			    vgn, pv_hash, lv_hash, 1, NULL)) {
 		log_error("Couldn't read all logical volume names for volume "


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

* LVM2/lib/format_text import_vsn1.c
@ 2011-03-27 13:44 agk
  0 siblings, 0 replies; 7+ messages in thread
From: agk @ 2011-03-27 13:44 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-03-27 13:44:09

Modified files:
	lib/format_text: import_vsn1.c 

Log message:
	Rename _check_version

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.85&r2=1.86

--- LVM2/lib/format_text/import_vsn1.c	2011/03/13 23:05:48	1.85
+++ LVM2/lib/format_text/import_vsn1.c	2011/03/27 13:44:08	1.86
@@ -54,7 +54,7 @@
  * Checks that the config file contains vg metadata, and that it
  * we recognise the version number,
  */
-static int _check_version(const struct config_tree *cft)
+static int _vsn1_check_version(const struct config_tree *cft)
 {
 	const struct config_node *cn;
 	const struct config_value *cv;
@@ -871,7 +871,7 @@
 }
 
 static struct text_vg_version_ops _vsn1_ops = {
-	.check_version = _check_version,
+	.check_version = _vsn1_check_version,
 	.read_vg = _read_vg,
 	.read_desc = _read_desc,
 	.read_vgname = _read_vgname,


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

* LVM2/lib/format_text import_vsn1.c
@ 2011-01-06 15:25 zkabelac
  0 siblings, 0 replies; 7+ messages in thread
From: zkabelac @ 2011-01-06 15:25 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-01-06 15:25:07

Modified files:
	lib/format_text: import_vsn1.c 

Log message:
	Intentionaly ignore result from get_config_uint32

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.80&r2=1.81

--- LVM2/lib/format_text/import_vsn1.c	2010/12/22 15:44:09	1.80
+++ LVM2/lib/format_text/import_vsn1.c	2011/01/06 15:25:07	1.81
@@ -840,7 +840,7 @@
 	log_suppress(old_suppress);
 	*desc = dm_pool_strdup(mem, d);
 
-	get_config_uint32(cft->root, "creation_time", &u);
+	(void) get_config_uint32(cft->root, "creation_time", &u);
 	*when = u;
 }
 


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

* LVM2/lib/format_text import_vsn1.c
@ 2010-12-22 15:44 zkabelac
  0 siblings, 0 replies; 7+ messages in thread
From: zkabelac @ 2010-12-22 15:44 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2010-12-22 15:44:09

Modified files:
	lib/format_text: import_vsn1.c 

Log message:
	Remove check for existance of vg pointer
	
	Checking for vg being != NULL in this place is not needed.
	Pointer vg is already dereferced in this function above this code line.
	Also this internal function _read_pv is always called with valid 'vg' pointer.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.79&r2=1.80

--- LVM2/lib/format_text/import_vsn1.c	2010/12/20 13:12:56	1.79
+++ LVM2/lib/format_text/import_vsn1.c	2010/12/22 15:44:09	1.80
@@ -257,14 +257,10 @@
 		log_verbose("Fixing up missing size (%s) "
 			    "for PV %s", display_size(fid->fmt->cmd, pv->size),
 			    pv_dev_name(pv));
-		if (vg) {
-			size = pv->pe_count * (uint64_t) vg->extent_size +
-			       pv->pe_start;
-			if (size > pv->size)
-				log_warn("WARNING: Physical Volume %s is too "
-					 "large for underlying device",
-					 pv_dev_name(pv));
-		}
+		size = pv->pe_count * (uint64_t) vg->extent_size + pv->pe_start;
+		if (size > pv->size)
+			log_warn("WARNING: Physical Volume %s is too large "
+				 "for underlying device", pv_dev_name(pv));
 	}
 
 	if (!alloc_pv_segment_whole_pv(mem, pv))


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

* LVM2/lib/format_text import_vsn1.c
@ 2010-04-06 14:04 wysochanski
  0 siblings, 0 replies; 7+ messages in thread
From: wysochanski @ 2010-04-06 14:04 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2010-04-06 14:04:03

Modified files:
	lib/format_text: import_vsn1.c 

Log message:
	Refactor _read_pv() code that updates vg->extent_count and vg->free_count.
	
	Simple refactor to mov code that updates the vg extent counts from a
	single pv's counts close to the code that adds a pv to vg->pvs and
	updates vg->pv_count.  No functional change.
	
	Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72

--- LVM2/lib/format_text/import_vsn1.c	2010/04/01 10:34:10	1.71
+++ LVM2/lib/format_text/import_vsn1.c	2010/04/06 14:04:03	1.72
@@ -241,10 +241,6 @@
 		return 0;
 	}
 
-	/* adjust the volume group. */
-	vg->extent_count += pv->pe_count;
-	vg->free_count += pv->pe_count;
-
 	pv->pe_size = vg->extent_size;
 
 	pv->pe_alloc_count = 0;
@@ -273,6 +269,8 @@
 	if (!alloc_pv_segment_whole_pv(mem, pv))
 		return_0;
 
+	vg->extent_count += pv->pe_count;
+	vg->free_count += pv->pe_count;
 	vg->pv_count++;
 	dm_list_add(&vg->pvs, &pvl->list);
 


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

* LVM2/lib/format_text import_vsn1.c
@ 2008-07-11  9:19 mornfall
  0 siblings, 0 replies; 7+ messages in thread
From: mornfall @ 2008-07-11  9:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2008-07-11 09:19:54

Modified files:
	lib/format_text: import_vsn1.c 

Log message:
	Fix gcc warnings.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52

--- LVM2/lib/format_text/import_vsn1.c	2008/07/10 11:30:57	1.51
+++ LVM2/lib/format_text/import_vsn1.c	2008/07/11 09:19:54	1.52
@@ -125,7 +125,7 @@
 	return 1;
 }
 
-static int _read_flag_config(struct config_node *n, int *status, int type)
+static int _read_flag_config(struct config_node *n, uint32_t *status, int type)
 {
 	struct config_node *cn;
 	*status = 0;
@@ -140,7 +140,7 @@
 		return 0;
 	}
 
-	if (cn = find_config_node(n, "flags")) {
+	if ((cn = find_config_node(n, "flags"))) {
 		if (!(read_flags(status, type, cn->v))) {
 			log_error("Could not read flags.");
 			return 0;
@@ -836,7 +836,7 @@
 				struct config_tree *cft, struct id *vgid,
 				uint32_t *vgstatus, char **creation_host)
 {
-	struct config_node *vgn, *cn;
+	struct config_node *vgn;
 	struct dm_pool *mem = fmt->cmd->mem;
 	char *vgname;
 	int old_suppress;


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

end of thread, other threads:[~2012-02-27 11:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-19 15:17 LVM2/lib/format_text import_vsn1.c zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2012-02-27 11:40 zkabelac
2011-03-27 13:44 agk
2011-01-06 15:25 zkabelac
2010-12-22 15:44 zkabelac
2010-04-06 14:04 wysochanski
2008-07-11  9:19 mornfall

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