Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/locking/locking.c man/lvc ...

PATCH [email protected] 1 participant 1 message Apr 13, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2010-04-13 01:54:34

Modified files:

	.              : WHATS_NEW 
	lib/locking    : locking.c 
	man            : lvconvert.8.in 
	tools          : args.h commands.h lvconvert.c lvcreate.c 

toollib.c toollib.h

Log message:
Add --stripes to lvconvert too.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1511&r2=1.1512
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.78&r2=1.79
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/lvconvert.8.in.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/args.h.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.143&r2=1.144
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.125&r2=1.126
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.219&r2=1.220
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.191&r2=1.192
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.71&r2=1.72

WHATS_NEW +1 -1
@@ -7,7 +7,7 @@
   Add --enable-write_install options to install user writable files.
   Use INSTALL_PROGRAM/DATA/WDATA target.
   Switch from using VPATH  to vpath in Makefiles.
-  Permit mimage LVs to be striped in lvcreate and lvresize.
+  Permit mimage LVs to be striped in lvcreate, lvresize and lvconvert.
   Fix pvmove allocation to take existing parallel stripes into account.
   Add pvmove_source_seg to struct lv_segment.
   Fix incorrect removal of symlinks after LV deactivation fails.
lib/locking/locking.c +2 -1
@@ -387,7 +387,8 @@
 		}
 
 		_update_vg_lock_count(resource, flags);
-	}
+	} else
+		stack;
 
 	_unlock_memory(cmd, lv_op);
 	_unblock_signals();
man/lvconvert.8.in +1 -0
@@ -7,6 +7,7 @@
 [\-A|\-\-alloc AllocationPolicy]
 [\-b|\-\-background] [\-f|\-\-force] [\-i|\-\-interval Seconds]
 [\-h|\-?|\-\-help]
+[\-\-stripes Stripes [\-I|\-\-stripesize StripeSize]]
 [\-\-noudevsync]
 [\-v|\-\-verbose] [\-y|\-\-yes]
 [\-\-version]
tools/args.h +3 -3
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
- * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2010 Red Hat, Inc. All rights reserved.
  *
  * This file is part of LVM2.
  *
@@ -14,8 +14,7 @@
  */
 
 /*
- * Put all long args that don't have a
- * corresponding short option first ...
+ * Put all long args that don't have a corresponding short option first.
  */
 /* *INDENT-OFF* */
 arg(version_ARG, '\0', "version", NULL, 0)
@@ -66,6 +65,7 @@
 arg(virtualsize_ARG, '\0', "virtualsize", size_mb_arg, 0)
 arg(noudevsync_ARG, '\0', "noudevsync", NULL, 0)
 arg(poll_ARG, '\0', "poll", yes_no_arg, 0)
+arg(stripes_long_ARG, '\0', "stripes", int_arg, 0)
 
 /* Allow some variations */
 arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0)
tools/commands.h +3 -1
@@ -105,6 +105,7 @@
    "\t[-f|--force]\n"
    "\t[-h|-?|--help]\n"
    "\t[-i|--interval seconds]\n"
+   "\t[--stripes Stripes [-I|--stripesize StripeSize]]\n"
    "\t[--noudevsync]\n"
    "\t[-v|--verbose]\n"
    "\t[-y|--yes]\n"
@@ -137,7 +138,8 @@
 
    alloc_ARG, background_ARG, chunksize_ARG, corelog_ARG, interval_ARG,
    merge_ARG, mirrorlog_ARG, mirrors_ARG, name_ARG, noudevsync_ARG,
-   regionsize_ARG, repair_ARG, snapshot_ARG, splitmirrors_ARG, test_ARG,
+   regionsize_ARG, repair_ARG, snapshot_ARG, splitmirrors_ARG,
+   stripes_long_ARG, stripesize_ARG, test_ARG,
    use_policies_ARG, yes_ARG, force_ARG, zero_ARG)
 
 xx(lvcreate,
tools/lvconvert.c +21 -6
@@ -35,6 +35,8 @@
 	uint32_t mirrors;
 	sign_t mirrors_sign;
 	uint32_t keep_mimages;
+	uint32_t stripes;
+	uint32_t stripe_size;
 
 	struct segment_type *segtype;
 
@@ -194,9 +196,11 @@
 
 	lp->alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_INHERIT);
 
-	if (lp->merge) {
+	/* There are three types of lvconvert. */
+	if (lp->merge) {	/* Snapshot merge */
 		if (arg_count(cmd, regionsize_ARG) || arg_count(cmd, chunksize_ARG) ||
-		    arg_count(cmd, zero_ARG) || arg_count(cmd, regionsize_ARG)) {
+		    arg_count(cmd, zero_ARG) || arg_count(cmd, regionsize_ARG) ||
+		    arg_count(cmd, stripes_long_ARG) || arg_count(cmd, stripesize_ARG)) {
 			log_error("Only --background and --interval are valid "
 				  "arguments for snapshot merge");
 			return 0;
@@ -205,12 +209,17 @@
 		if (!(lp->segtype = get_segtype_from_string(cmd, "snapshot")))
 			return_0;
 
-	} else if (lp->snapshot) {
+	} else if (lp->snapshot) {	/* Snapshot creation from pre-existing cow */
 		if (arg_count(cmd, regionsize_ARG)) {
 			log_error("--regionsize is only available with mirrors");
 			return 0;
 		}
 
+		if (arg_count(cmd, stripesize_ARG) || arg_count(cmd, stripes_long_ARG)) {
+			log_error("--stripes and --stripesize are only available with striped mirrors");
+			return 0;
+		}
+
 		if (arg_sign_value(cmd, chunksize_ARG, 0) == SIGN_MINUS) {
 			log_error("Negative chunk size is invalid");
 			return 0;
@@ -287,6 +296,12 @@
 			return 0;
 		}
 
+		/* Default is never striped, regardless of existing LV configuration. */
+		if (!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size)) {
+			stack;
+			return 0;
+		}
+
 		if (!(lp->segtype = get_segtype_from_string(cmd, "mirror")))
 			return_0;
 	}
@@ -950,8 +965,8 @@
 		 * currently taken by the mirror? Would make more sense from
 		 * user perspective.
 		 */
-		if (!lv_add_mirrors(cmd, lv, new_mimage_count - 1, 1,
-				    0, region_size, new_log_count, operable_pvs,
+		if (!lv_add_mirrors(cmd, lv, new_mimage_count - 1, lp->stripes,
+				    lp->stripe_size, region_size, new_log_count, operable_pvs,
 				    lp->alloc, MIRROR_BY_LV)) {
 			stack;
 			return failure_code;
@@ -1005,7 +1020,7 @@
 
 		/* FIXME: can't have multiple mlogs. force corelog. */
 		if (!lv_add_mirrors(cmd, lv,
-				    new_mimage_count - old_mimage_count, 1, 0,
+				    new_mimage_count - old_mimage_count, lp->stripes, lp->stripe_size,
 				    region_size, 0U, operable_pvs, lp->alloc,
 				    MIRROR_BY_LV)) {
 			layer_lv = seg_lv(first_seg(lv), 0);
tools/lvcreate.c +1 -70

89 lines not on this page · raw message

tools/toollib.c +62 -0

65 lines not on this page · raw message

tools/toollib.h +3 -0
@@ -115,5 +115,8 @@
 int get_activation_monitoring_mode(struct cmd_context *cmd,
 				   struct volume_group *vg,
 				   int *monitoring_mode);
+int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes,
+		      uint32_t *stripe_size);
+
 
 #endif