Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/lv_manip.c lib/m ...

PATCH [email protected] 2 participants 2 messages Jan 8, 2010 – Jan 11, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow at sourceware.org 2010-01-08 22:32:35

Modified files:

	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c metadata-exported.h mirror.c 
	man            : lvconvert.8.in lvcreate.8.in 
	tools          : commands.h lvconvert.c lvcreate.c 

Log message:
Add the new mirror log type "redundant". The options are now:
--mirrorlog core: in-memory log
--mirrorlog disk: persistent log
--mirrorlog redundant: redundant persistent log

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1376&r2=1.1377
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.191&r2=1.192
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata-exported.h.diff?cvsroot=lvm2&r1=1.124&r2=1.125
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.105&r2=1.106
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.in.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvcreate.8.in.diff?cvsroot=lvm2&r1=1.12&r2=1.13
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.137&r2=1.138
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.105&r2=1.106
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.212&r2=1.213

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.57 -
 ====================================
+  Add redundant mirror log option.
   Add capability to split off and keep mirror legs to lvconvert.
   Change background polldaemon's process name to "(lvm2)".
   Allow vgremove of a VG with PVs missing.
lib/metadata/lv_manip.c +97 -43

293 lines not on this page · raw message

lib/metadata/metadata-exported.h +3 -1
@@ -527,7 +527,7 @@
 	int zero; /* all */
 	int major; /* all */
 	int minor; /* all */
-	int corelog; /* mirror */
+	int log_count; /* mirror */
 	int nosync; /* mirror */
 
 	char *origin; /* snap */
@@ -652,6 +652,8 @@
 		   uint32_t mirrors, uint32_t stripes,
 		   uint32_t region_size, uint32_t log_count,
 		   struct dm_list *pvs, alloc_policy_t alloc, uint32_t flags);
+int lv_split_mirror_images(struct logical_volume *lv, const char *split_lv_name,
+			   uint32_t split_count, struct dm_list *removable_pvs);
 int lv_remove_mirrors(struct cmd_context *cmd, struct logical_volume *lv,
 		      uint32_t mirrors, uint32_t log_count,
 		      struct dm_list *pvs, uint64_t status_mask);
lib/metadata/mirror.c +51 -41

146 lines not on this page · raw message

man/lvconvert.8.in +2 -1
@@ -3,7 +3,7 @@
 lvconvert \- convert a logical volume from linear to mirror or snapshot
 .SH SYNOPSIS
 .B lvconvert
-\-m|\-\-mirrors Mirrors [\-\-mirrorlog {disk|core}] [\-\-corelog] [\-R|\-\-regionsize MirrorLogRegionSize]
+\-m|\-\-mirrors Mirrors [\-\-mirrorlog {disk|core|redundant}] [\-\-corelog] [\-R|\-\-regionsize MirrorLogRegionSize]
 [\-A|\-\-alloc AllocationPolicy]
 [\-b|\-\-background] [\-f|\-\-force] [\-i|\-\-interval Seconds]
 [\-h|\-?|\-\-help]
@@ -71,6 +71,7 @@
 Core may be useful for short-lived mirrors: It means the mirror is
 regenerated by copying the data from the first device again every
 time the device is activated - perhaps, for example, after every reboot.
+Using "redundant" will create a persistent log that is itself mirrored.
 .TP
 .I \-\-corelog
 The optional argument "--corelog" is the same as specifying "--mirrorlog core".
man/lvcreate.8.in +4 -3
@@ -11,7 +11,7 @@
 {\-l|\-\-extents LogicalExtentsNumber[%{VG|PVS|FREE}] |
  \-L|\-\-size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}
 [\-M|\-\-persistent y|n] [\-\-minor minor]
-[\-m|\-\-mirrors Mirrors [\-\-nosync] [\-\-mirrorlog {disk|core}] [\-\-corelog]
+[\-m|\-\-mirrors Mirrors [\-\-nosync] [\-\-mirrorlog {disk|core|redundant}] [\-\-corelog]
 [\-R|\-\-regionsize MirrorLogRegionSize]]
 [\-n|\-\-name LogicalVolumeName]
 [\-p|\-\-permission r|rw] [\-r|\-\-readahead ReadAheadSectors|auto|none]
@@ -107,9 +107,10 @@
 The optional argument --mirrorlog specifies the type of log to be used.
 The default is disk, which is persistent and requires
 a small amount of storage space, usually on a separate device from the
-data being mirrored. Using core means the mirror is regenerated
+data being mirrored.  Using core means the mirror is regenerated
 by copying the data from the first device again each time the
-device is activated, for example, after every reboot.
+device is activated, for example, after every reboot.  Using "redundant"
+will create a persistent log that is itself mirrored.
 
 The optional argument --corelog is equivalent to --mirrorlog core.
 
tools/commands.h +2 -2
@@ -96,7 +96,7 @@
    "Change logical volume layout",
    0,
    "lvconvert "
-   "[-m|--mirrors Mirrors [{--mirrorlog {disk|core}|--corelog}]]\n"
+   "[-m|--mirrors Mirrors [{--mirrorlog {disk|core|redundant}|--corelog}]]\n"
    "\t[--repair [--use-policies]]\n"
    "\t[-R|--regionsize MirrorLogRegionSize]\n"
    "\t[--alloc AllocationPolicy]\n"
@@ -145,7 +145,7 @@
    "\t{-l|--extents LogicalExtentsNumber |\n"
    "\t -L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}\n"
    "\t[-M|--persistent {y|n}] [--major major] [--minor minor]\n"
-   "\t[-m|--mirrors Mirrors [--nosync] [{--mirrorlog {disk|core}|--corelog}]]\n"
+   "\t[-m|--mirrors Mirrors [--nosync] [{--mirrorlog {disk|core|redundant}|--corelog}]]\n"
    "\t[-n|--name LogicalVolumeName]\n"
    "\t[--noudevsync]\n"
    "\t[-p|--permission {r|rw}]\n"
tools/lvconvert.c +40 -27

142 lines not on this page · raw message

tools/lvcreate.c +19 -11
@@ -323,21 +323,29 @@
 	int region_size;
 	const char *mirrorlog;
 
+	/*
+	 * This param used to be 'corelog' and was initialized to '0'.
+	 * We initially set to '1' here so as not to screw the logic.
+	 */
+	lp->log_count = 1;
 	if (arg_count(cmd, corelog_ARG))
-		lp->corelog = 1;
+		lp->log_count = 0;
 
 	mirrorlog = arg_str_value(cmd, mirrorlog_ARG,
-				  lp->corelog ? "core" : DEFAULT_MIRRORLOG);
+				  !lp->log_count ? "core" : DEFAULT_MIRRORLOG);
 
-	if (!strcmp("disk", mirrorlog)) {
-		if (lp->corelog) {
-			log_error("--mirrorlog disk and --corelog "
-				  "are incompatible");
-			return 0;
-		}
-		lp->corelog = 0;
-	} else if (!strcmp("core", mirrorlog))
-		lp->corelog = 1;
+	if (strcmp("core", mirrorlog) && !lp->log_count) {
+		log_error("--mirrorlog disk and --corelog "
+			  "are incompatible");
+		return 0;
+	}
+
+	if (!strcmp("redundant", mirrorlog))
+		lp->log_count = 2;
+	else if (!strcmp("disk", mirrorlog))
+		lp->log_count = 1;
+	else if (!strcmp("core", mirrorlog))
+		lp->log_count = 0;
 	else {
 		log_error("Unknown mirrorlog type: %s", mirrorlog);
 		return 0;
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dne 8.1.2010 23:32, jbrassow at sourceware.org napsal(a):

Quoted 20 lines

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow at sourceware.org 2010-01-08 22:32:35

Modified files:

	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c metadata-exported.h mirror.c 
	man            : lvconvert.8.in lvcreate.8.in 
	tools          : commands.h lvconvert.c lvcreate.c 

Log message:
Add the new mirror log type "redundant". The options are now:
--mirrorlog core: in-memory log
--mirrorlog disk: persistent log
--mirrorlog redundant: redundant persistent log

tools/lvconvert.c line 675

Quoted 6 lines
tools/lvconvert.c +1 -1
@@ -671,7 +671,7 @@
 	if (existing_mirrors && lp->mirrors &&
 	    (lp->mirrors != existing_mirrors) &&
 	    !arg_count(cmd, mirrorlog_ARG) && !arg_count(cmd, corelog_ARG)) {
-		corelog = first_seg(lv)->log_lv ? 0 : 1;
+		log_count = lv_mirror_count(first_seg(lv)->log_lv);
 	}

Hmm - this change has unpleasant result for our mirror testcase from test suit:

(gdb) bt
#0 0x080c23fe in lv_mirror_count (lv=0x0) at metadata/mirror.c:83 #1 0x0805b3f2 in _lvconvert_mirrors (cmd=0x9b5b028, lv=0x9b8e638, lp=0xfff5bda0) at lvconvert.c:674
#2 0x0805cd9e in lvconvert_single (cmd=0x9b5b028, lv=0x9b8e638, handle=0xfff5bda0) at lvconvert.c:1079
#3 0x0805d04b in lvconvert (cmd=0x9b5b028, argc=1, argv=0xfff5bf68) at lvconvert.c:1130
#4 0x08064805 in lvm_run_command (cmd=0x9b5b028, argc=1, argv=0xfff5bf68) at lvmcmdline.c:1030
#5 0x08065641 in lvm2_main (argc=5, argv=0xfff5bf58) at lvmcmdline.c:1373 #6 0x0807ed76 in main (argc=135335936, argv=0x55572670) at lvm.c:21

Obviously log_lv is 0 and lv_mirror_count fails.

Zdenek
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJLSyjhAAoJEBiFrTh9QvFuXugP/isId9iUo0m1cjl1MmtIy973 8tKofM69IVm4/YoFlfaRTcFimv+LwTUA7noMroHwsaKA+d232eUKc1/SWFALop1c /2OZzt53qaSjOBdfqSHpeNzXD4ce4yE6bkqcJ2pFIwAgzjNACwTC5R04Aw24Byll /B/dwOWRy1cYHWsu/0pnFG8jL5MCdnXnlrh8AwrmoBCKFe6cMLkdwAsWSl0Q9N+d em0q+z6OEbQYRjneLJMQ7WiEIt1Ow19K0LMVTIuO9g5ETPxjmX5yXhdLCT80RbTB XKaLBAYTEpgNNT7CyTPkGxTAzMsNVjmU9bZBg6Jiclu6Bdy5KXY2wT1y6269rrhf 4pGxAz3fVWXXOKAtXPhKFxOmFk5+LzmZRx/QveISWKt7yuqbLTqSiHlxgAegwq6S fjCvB1YEDYePncc3okmhX5CEf8n172R2BN+zywxWgRVo49nOrHJo22pag64cS+Wk eKBbGO5c6b/V4zksxfgEDCXML/7UDNGZXXPA9GAq8Rom3kfIVwiLCMbV+7wMCvYY 2IArlaw5uMd2bkQnDjG8lgz5lw2k4hmfPTJDs45Q+sg61UcjVv9KUizlEHIpVhJc njKxnCGhGE8Q3YXpMEUKAaOMnVupSXhsPpZQvNZ/XnrkBaPDLGqGA09aJFjZC/hh 5PzvHa7NUnUJsR7jKNVk
=Nbnq
-----END PGP SIGNATURE-----