Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/mirror.c man/lvc ...

PATCH [email protected] 1 participant 1 message Dec 22, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2007-12-22 12:13:30

Modified files:

	.              : WHATS_NEW 
	lib/metadata   : mirror.c 
	man            : lvconvert.8 
	tools          : commands.h lvconvert.c polldaemon.c 

polldaemon.h pvmove.c

Log message:
lvconvert uses polldaemon now

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.748&r2=1.749
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.104&r2=1.105
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/polldaemon.h.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.45&r2=1.46

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.30 -
 ===================================
+  Extend lvconvert to use polldaemon.
   Add support for stacked mirrors.
   Major restructuring of pvmove and lvconvert layer manipulation code.
   Replace tools/fsadm with scripts/fsadm.sh.
lib/metadata/mirror.c +11 -3
@@ -1068,6 +1068,8 @@
 						 int in_sync)
 {
 	struct logical_volume *log_lv;
+	const char *suffix;
+	struct lv_segment *seg;
 
 	init_mirror_in_sync(in_sync);
 
@@ -1076,9 +1078,15 @@
 		return NULL;
 	}
 
-	if (!(log_lv = _create_mirror_log(lv, ah, alloc, lv->name,
-					  strstr(lv->name, MIRROR_SYNC_LAYER)
-						? "_mlogtmp_%d" : "_mlog"))) {
+	/* Check if the log is for temporary sync layer. */
+	seg = first_seg(lv);
+	if (seg_type(seg, 0) == AREA_LV &&
+	    strstr(seg_lv(seg, 0)->name, MIRROR_SYNC_LAYER))
+		suffix = "_mlogtmp_%d";
+	else
+		suffix = "_mlog";
+
+	if (!(log_lv = _create_mirror_log(lv, ah, alloc, lv->name, suffix))) {
 		log_error("Failed to create mirror log.");
 		return NULL;
 	}
man/lvconvert.8 +7 -0
@@ -5,6 +5,7 @@
 .B lvconvert
 \-m/\-\-mirrors Mirrors [\-\-mirrorlog {disk|core}] [\-\-corelog] [\-R/\-\-regionsize MirrorLogRegionSize]
 [\-A/\-\-alloc AllocationPolicy]
+[\-b/\-\-background] [\-i/\-\-interval Seconds]
 [\-h/\-?/\-\-help]
 [\-v/\-\-verbose]
 [\-\-version]
@@ -52,6 +53,12 @@
 .I \-R, \-\-regionsize MirrorLogRegionSize
 A mirror is divided into regions of this size (in MB), and the mirror log
 uses this granularity to track which regions are in sync.
+.TP
+.I \-b, \-\-background
+Run the daemon in the background.
+.TP
+.I \-i, \-\-interval Seconds
+Report progress as a percentage at regular intervals.
 .br
 .TP
 .I \-s, \-\-snapshot
tools/commands.h +4 -2
@@ -91,8 +91,10 @@
    "[-m|--mirrors Mirrors [{--mirrorlog {disk|core}|--corelog}]]\n"
    "\t[-R|--regionsize MirrorLogRegionSize]\n"
    "\t[--alloc AllocationPolicy]\n"
+   "\t[-b|--background]\n"
    "\t[-d|--debug]\n"
    "\t[-h|-?|--help]\n"
+   "\t[-i|--interval seconds]\n"
    "\t[-v|--verbose]\n"
    "\t[--version]" "\n"
    "\tLogicalVolume[Path] [PhysicalVolume[Path]...]\n\n"
@@ -107,8 +109,8 @@
    "\t[--version]" "\n"
    "\tOriginalLogicalVolume[Path] SnapshotLogicalVolume[Path]\n",
 
-   alloc_ARG, chunksize_ARG, corelog_ARG, mirrorlog_ARG, mirrors_ARG,
-   regionsize_ARG, snapshot_ARG, test_ARG, zero_ARG)
+   alloc_ARG, background_ARG, chunksize_ARG, corelog_ARG, interval_ARG,
+   mirrorlog_ARG, mirrors_ARG, regionsize_ARG, snapshot_ARG, test_ARG, zero_ARG)
 
 xx(lvcreate,
    "Create a logical volume",
tools/lvconvert.c +100 -8

164 lines not on this page · raw message

tools/polldaemon.c +7 -3
@@ -93,9 +93,11 @@
 
 	overall_percent = copy_percent(lv_mirr);
 	if (parms->progress_display)
-		log_print("%s: Moved: %.1f%%", name, overall_percent);
+		log_print("%s: %s: %.1f%%", name, parms->progress_title,
+			  overall_percent);
 	else
-		log_verbose("%s: Moved: %.1f%%", name, overall_percent);
+		log_verbose("%s: %s: %.1f%%", name, parms->progress_title,
+			    overall_percent);
 
 	if (segment_percent < 100.0) {
 		/* The only case the caller *should* try again later */
@@ -224,7 +226,8 @@
 }
 
 int poll_daemon(struct cmd_context *cmd, const char *name, unsigned background,
-		uint32_t lv_type, struct poll_functions *poll_fns)
+		uint32_t lv_type, struct poll_functions *poll_fns,
+		const char *progress_title)
 {
 	struct daemon_parms parms;
 
@@ -232,6 +235,7 @@
 	parms.background = background;
 	parms.interval = arg_uint_value(cmd, interval_ARG, DEFAULT_INTERVAL);
 	parms.progress_display = 1;
+	parms.progress_title = progress_title;
 	parms.lv_type = lv_type;
 	parms.poll_fns = poll_fns;
 
tools/polldaemon.h +3 -1
@@ -42,11 +42,13 @@
 	unsigned background;
 	unsigned outstanding_count;
 	unsigned progress_display;
+	const char *progress_title;
 	uint32_t lv_type;
 	struct poll_functions *poll_fns;
 };
 
 int poll_daemon(struct cmd_context *cmd, const char *name, unsigned background,
-		uint32_t lv_type, struct poll_functions *poll_fns);
+		uint32_t lv_type, struct poll_functions *poll_fns,
+		const char *progress_title);
 
 #endif
tools/pvmove.c +2 -1
@@ -525,7 +525,8 @@
 int pvmove_poll(struct cmd_context *cmd, const char *pv_name,
 		unsigned background)
 {
-	return poll_daemon(cmd, pv_name, background, PVMOVE, &_pvmove_fns);
+	return poll_daemon(cmd, pv_name, background, PVMOVE, &_pvmove_fns,
+			   "Moved");
 }
 
 int pvmove(struct cmd_context *cmd, int argc, char **argv)