public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: zkabelac@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/lib/format_text import_vsn1.c
Date: Mon, 27 Feb 2012 11:40:00 -0000	[thread overview]
Message-ID: <20120227114058.29902.qmail@sourceware.org> (raw)

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 "


             reply	other threads:[~2012-02-27 11:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-27 11:40 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-01-19 15:17 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120227114058.29902.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).