Skip to contentSkip to conversation

LVM: corelog to log_count

PATCH New Jonathan Brassow 1 participant 1 message Oct 8, 2009 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 LVM: corelog to log_count

Patch name: lvm-corelog-to-log_count.patch

s/corelog/log_count/ We must make the binary 'corelog' argument more general. This patch simply swaps 'corelog' for 'log_count'.

RFC: Jonathan Brassow <[email protected]>

lib/metadata/metadata-exported.h +1 -1
Index: LVM2/lib/metadata/metadata-exported.h
===================================================================
@@ -523,7 +523,7 @@ struct lvcreate_params {
 	int zero; /* all */
 	int major; /* all */
 	int minor; /* all */
-	int corelog; /* mirror */
+	int log_count; /* mirror */
 	int nosync; /* mirror */
 
 	char *origin; /* snap */
tools/lvconvert.c +37 -26

131 lines not on this page · raw message

tools/lvcreate.c +17 -11
Index: LVM2/tools/lvcreate.c
===================================================================
@@ -325,21 +325,27 @@ static int _read_mirror_params(struct lv
 	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("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;
lib/metadata/lv_manip.c +1 -1
Index: LVM2/lib/metadata/lv_manip.c
===================================================================
@@ -3097,7 +3097,7 @@ int lv_create_single(struct volume_group
 						vg->extent_size,
 						lv->le_count,
 						lp->region_size),
-				    lp->corelog ? 0U : 1U, lp->pvh, lp->alloc,
+				    lp->log_count, lp->pvh, lp->alloc,
 				    MIRROR_BY_LV |
 				    (lp->nosync ? MIRROR_SKIP_INIT_SYNC : 0))) {
 			stack;

--
lvm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/lvm-devel