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/thin thin.c
Date: Sat, 22 Oct 2011 16:45:00 -0000	[thread overview]
Message-ID: <20111022164526.8793.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-22 16:45:25

Modified files:
	lib/thin       : thin.c 

Log message:
	Consistently use metadata LV as the first in MDA
	
	Cosmetic cleanup.
	Mark LV as thin pool before calling attach_pool functions.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/thin/thin.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25

--- LVM2/lib/thin/thin.c	2011/10/21 11:38:36	1.24
+++ LVM2/lib/thin/thin.c	2011/10/22 16:45:25	1.25
@@ -92,34 +92,35 @@
 	const char *lv_name;
 	struct logical_volume *pool_data_lv, *pool_metadata_lv;
 
-	if (!dm_config_get_str(sn, "pool", &lv_name))
-		return SEG_LOG_ERROR("Pool must be a string in");
-
-	if (!(pool_data_lv = find_lv(seg->lv->vg, lv_name)))
-		return SEG_LOG_ERROR("Unknown pool %s in", lv_name);
-
 	if (!dm_config_get_str(sn, "metadata", &lv_name))
 		return SEG_LOG_ERROR("Metadata must be a string in");
 
 	if (!(pool_metadata_lv = find_lv(seg->lv->vg, lv_name)))
 		return SEG_LOG_ERROR("Unknown metadata %s in", lv_name);
 
-	if (!attach_pool_data_lv(seg, pool_data_lv))
-		return_0;
+	if (!dm_config_get_str(sn, "pool", &lv_name))
+		return SEG_LOG_ERROR("Pool must be a string in");
 
+	if (!(pool_data_lv = find_lv(seg->lv->vg, lv_name)))
+		return SEG_LOG_ERROR("Unknown pool %s in", lv_name);
+
+	seg->lv->status |= THIN_POOL;
 	if (!attach_pool_metadata_lv(seg, pool_metadata_lv))
 		return_0;
 
+	if (!attach_pool_data_lv(seg, pool_data_lv))
+		return_0;
+
 	if (!dm_config_get_uint64(sn, "transaction_id", &seg->transaction_id))
 		return SEG_LOG_ERROR("Could not read transaction_id for");
 
+	if (!dm_config_get_uint32(sn, "data_block_size", &seg->data_block_size))
+		return SEG_LOG_ERROR("Could not read data_block_size");
+
 	if (dm_config_has_node(sn, "low_water_mark") &&
 	    !dm_config_get_uint64(sn, "low_water_mark", &seg->low_water_mark))
 		return SEG_LOG_ERROR("Could not read low_water_mark");
 
-	if (!dm_config_get_uint32(sn, "data_block_size", &seg->data_block_size))
-		return SEG_LOG_ERROR("Could not read data_block_size");
-
 	if ((seg->data_block_size < DM_THIN_MIN_DATA_BLOCK_SIZE) ||
 	    (seg->data_block_size > DM_THIN_MAX_DATA_BLOCK_SIZE))
 		return SEG_LOG_ERROR("Unsupported value %u for data_block_size",
@@ -129,8 +130,6 @@
 	    !dm_config_get_uint32(sn, "zero_new_blocks", &seg->zero_new_blocks))
 		return SEG_LOG_ERROR("Could not read zero_new_blocks for");
 
-	seg->lv->status |= THIN_POOL;
-
 	/* Read messages */
 	for (; sn; sn = sn->sib)
 		if (!(sn->v) && !_thin_pool_add_message(seg, sn->key, sn->child))
@@ -152,9 +151,10 @@
 	unsigned cnt = 0;
 	const struct lv_thin_message *tmsg;
 
-	outf(f, "pool = \"%s\"", seg_lv(seg, 0)->name);
 	outf(f, "metadata = \"%s\"", seg->pool_metadata_lv->name);
+	outf(f, "pool = \"%s\"", seg_lv(seg, 0)->name);
 	outf(f, "transaction_id = %" PRIu64, seg->transaction_id);
+// FIXME  maybe switch to use  chunksize (as with snapshot ??)
 	outf(f, "data_block_size = %u", seg->data_block_size);
 
 	if (seg->low_water_mark)


             reply	other threads:[~2011-10-22 16:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-22 16:45 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-01-19 15:42 zkabelac
2011-12-21 12:56 zkabelac
2011-11-03 14:37 zkabelac
2011-10-28 20:25 zkabelac
2011-10-20 10:32 zkabelac
2011-10-20 10:30 zkabelac
2011-10-17 14:17 zkabelac
2011-10-11  8:51 zkabelac
2011-10-06 11:06 zkabelac
2011-09-06 22:35 zkabelac
2011-09-01 10:16 zkabelac

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