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

[lvm-devel] [PATCH lvconvert 11/11] Start lvconvert polldaemon on activation (like pvmove)



polldaemon should be invoked on activation
if the LV is under conversion.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
Like pvmove, polling daemon should start when the LV under conversion
is activated.
When the LV is deactivated during the conversion, polldaemon will
automatically die.

Index: LVM2.work/tools/lvchange.c
===================================================================
--- LVM2.work.orig/tools/lvchange.c
+++ LVM2.work/tools/lvchange.c
@@ -106,6 +106,8 @@ static int lvchange_availability(struct 
 {
 	int activate;
 	const char *pvname;
+	char *lv_full_name;
+	uint32_t len;
 
 	activate = arg_uint_value(cmd, available_ARG, 0);
 
@@ -158,6 +160,18 @@ static int lvchange_availability(struct 
 				    pvname);
 			pvmove_poll(cmd, pvname, 1);
 		}
+
+		if (lv->status & CONVERTING) {
+			len = strlen(lv->vg->name) + strlen(lv->name) + 2;
+			if (!(lv_full_name = alloca(len)))
+				return_0;
+			if (!dm_snprintf(lv_full_name, len, "%s/%s",
+					 lv->vg->name, lv->name))
+				return_0;
+			log_verbose("Spawning background lvconvert process for %s",
+				    lv->name);
+			lvconvert_poll(cmd, lv_full_name, 1);
+		}
 	}
 
 	return 1;
Index: LVM2.work/tools/tools.h
===================================================================
--- LVM2.work.orig/tools/tools.h
+++ LVM2.work/tools/tools.h
@@ -165,5 +165,6 @@ int arg_count_increment(struct cmd_conte
 const char *command_name(struct cmd_context *cmd);
 
 int pvmove_poll(struct cmd_context *cmd, const char *pv, unsigned background);
+int lvconvert_poll(struct cmd_context *cmd, const char *lv_name, unsigned background);
 
 #endif
Index: LVM2.work/tools/lvconvert.c
===================================================================
--- LVM2.work.orig/tools/lvconvert.c
+++ LVM2.work/tools/lvconvert.c
@@ -309,8 +309,8 @@ static struct poll_functions _lvconvert_
 	.finish_copy = _finish_lvconvert_mirror,
 };
 
-static int _lvconvert_poll(struct cmd_context *cmd, const char *lv_name,
-			   unsigned background)
+int lvconvert_poll(struct cmd_context *cmd, const char *lv_name,
+		   unsigned background)
 {
 	return poll_daemon(cmd, lv_name, background, 0, &_lvconvert_mirror_fns,
 			   "Converted");
@@ -745,8 +745,8 @@ error:
 			log_print("Conversion starts after activation");
 			return ret;
 		}
-		ret = _lvconvert_poll(cmd, lp.lv_name_full,
-				      arg_count(cmd, background_ARG) ? 1U : 0);
+		ret = lvconvert_poll(cmd, lp.lv_name_full,
+				     arg_count(cmd, background_ARG) ? 1U : 0);
 	}
 
 	return ret;

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