[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH 1/4] Fix '--nosync' option of lvcreate and remove unnecessary tag collection



This patch fixes 2 things.

While converting lvcreate to use the newly added lv_add_mirrors(),
I mistakenly moved the MIRROR_NOTSYNCED flag setting *after*
lv_create_empty().
As a result, '--nosync' option of lvcreate becomes nop.
This patch moves the flag setting and makes nosync option working again.

In the old code, tag list is created and passed for mirror log creation
function because the log was created before the LV.
In the current code, linear LV is created first and the log creation
function takes tag list from the LV. So we don't need to create
tag list in lvcreate.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
During the conversion to the new lv_add_mirrors() API,
the setting of MIRROR_NOTSYNCED was moved to *after* the
lv_create_empty() and effectively disabled the nosync option.

Also, tag collection for mirror log activation is no longer
necessary in the current code because log setup will be done
after adding the tag to the LV. So remove it.

Index: LVM2.work/tools/lvcreate.c
===================================================================
--- LVM2.work.orig/tools/lvcreate.c
+++ LVM2.work/tools/lvcreate.c
@@ -525,7 +525,7 @@ static int _lvcreate(struct cmd_context 
 	uint32_t status = 0;
 	uint64_t tmp_size;
 	struct logical_volume *lv, *org = NULL;
-	struct list *pvh, tags;
+	struct list *pvh;
 	const char *tag = NULL;
 	int origin_active = 0;
 	char lv_name_buf[128];
@@ -744,6 +744,16 @@ static int _lvcreate(struct cmd_context 
 		}
 	}
 
+	if (lp->mirrors > 1) {
+		init_mirror_in_sync(lp->nosync);
+
+		if (lp->nosync) {
+			log_warn("WARNING: New mirror won't be synchronised. "
+				  "Don't read what you didn't write!");
+			status |= MIRROR_NOTSYNCED;
+		}
+	}
+
 	if (!(lv = lv_create_empty(lv_name ? lv_name : "lvol%d", NULL,
 				   status, lp->alloc, 0, vg))) {
 		stack;
@@ -774,18 +784,6 @@ static int _lvcreate(struct cmd_context 
 		return_0;
 
 	if (lp->mirrors > 1) {
-		init_mirror_in_sync(lp->nosync);
-
-		if (lp->nosync) {
-			log_warn("WARNING: New mirror won't be synchronised. "
-				  "Don't read what you didn't write!");
-			status |= MIRROR_NOTSYNCED;
-		}
-
-		list_init(&tags);
-		if (tag)
-			str_list_add(cmd->mem, &tags, tag);
-
 		if (!lv_add_mirrors(cmd, lv, lp->mirrors - 1, lp->stripes,
 				    adjusted_mirror_region_size(
 						vg->extent_size,

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]