public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ...
@ 2011-10-06 15:32 jbrassow
  0 siblings, 0 replies; 8+ messages in thread
From: jbrassow @ 2011-10-06 15:32 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	jbrassow@sourceware.org	2011-10-06 15:32:27

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c 
	tools          : commands.h lvresize.c 

Log message:
	Allow 'nosync' extension of mirrors.
	
	This patch allows a mirror to be extended without an initial resync of the
	extended portion.  It compliments the existing '--nosync' option to lvcreate.
	This action can be done implicitly if the mirror was created with the '--nosync'
	option, or explicitly if the '--nosync' option is used when extending the device.
	
	Here are the operational criteria:
	1) A mirror created with '--nosync' should extend with 'nosync' implicitly
	[EXAMPLE]# lvs vg; lvextend -L +5G vg/lv ; lvs vg
	LV   VG   Attr     LSize Pool Origin Snap%  Move Log     Copy%  Convert
	lv   vg   Mwi-a-m- 5.00g                         lv_mlog 100.00
	Extending 2 mirror images.
	Extending logical volume lv to 10.00 GiB
	Logical volume lv successfully resized
	LV   VG   Attr     LSize  Pool Origin Snap%  Move Log     Copy%  Convert
	lv   vg   Mwi-a-m- 10.00g                         lv_mlog 100.00
	
	2) The 'M' attribute ('M' signifies a mirror created with '--nosync', while 'm'
	signifies a mirror created w/o '--nosync') must be preserved when extending a
	mirror created with '--nosync'.  See #1 for example of 'M' attribute.
	
	3) A mirror created without '--nosync' should extend with 'nosync' only when
	'--nosync' is explicitly used when extending.
	[EXAMPLE]# lvs vg; lvextend -L +5G vg/lv; lvs vg
	LV   VG   Attr     LSize  Pool Origin Snap%  Move Log     Copy%  Convert
	lv   vg   mwi-a-m- 20.00m                         lv_mlog 100.00
	Extending 2 mirror images.
	Extending logical volume lv to 5.02 GiB
	Logical volume lv successfully resized
	LV   VG   Attr     LSize Pool Origin Snap%  Move Log     Copy%  Convert
	lv   vg   mwi-a-m- 5.02g                         lv_mlog   0.39
	vs.
	[EXAMPLE]# lvs vg; lvextend -L +5G vg/lv --nosync; lvs vg
	LV   VG   Attr     LSize  Pool Origin Snap%  Move Log     Copy%  Convert
	lv   vg   mwi-a-m- 20.00m                         lv_mlog 100.00
	Extending 2 mirror images.
	Extending logical volume lv to 5.02 GiB
	Logical volume lv successfully resized
	LV   VG   Attr     LSize Pool Origin Snap%  Move Log     Copy%  Convert
	lv   vg   Mwi-a-m- 5.02g                         lv_mlog 100.00
	
	4) The 'm' attribute must change to 'M' when extending a mirror created without
	'--nosync' is extended with the '--nosync' option.  (See #3 examples above.)
	
	5) An inactive mirror's sync percent cannot be determined definitively, so it
	must not be allowed to skip resync.  Instead, the extend should ask the user if
	they want to extend while performing a resync.
	[EXAMPLE]# lvchange -an vg/lv
	[EXAMPLE]# lvextend -L +5G vg/lv
	Extending 2 mirror images.
	Extending logical volume lv to 10.00 GiB
	vg/lv is not active.  Unable to get sync percent.
	Do full resync of extended portion of vg/lv?  [y/n]: y
	Logical volume lv successfully resized
	
	6) A mirror that is performing recovery (as opposed to an initial sync) - like
	after a failure - is not allowed to extend with either an implicit or
	explicit nosync option.  [You can simulate this with a 'corelog' mirror because
	when it is reactivated, it must be recovered every time.]
	[EXAMPLE]# lvcreate -m1 -L 5G -n lv vg --nosync --corelog
	WARNING: New mirror won't be synchronised. Don't read what you didn't write!
	Logical volume "lv" created
	[EXAMPLE]# lvs vg
	LV   VG   Attr     LSize Pool Origin Snap%  Move Log Copy%  Convert
	lv   vg   Mwi-a-m- 5.00g                             100.00
	[EXAMPLE]# lvchange -an vg/lv; lvchange -ay vg/lv; lvs vg
	LV   VG   Attr     LSize Pool Origin Snap%  Move Log Copy%  Convert
	lv   vg   Mwi-a-m- 5.00g                               0.08
	[EXAMPLE]# lvextend -L +5G vg/lv
	Extending 2 mirror images.
	Extending logical volume lv to 10.00 GiB
	vg/lv cannot be extended while it is recovering.
	
	7) If 'no' is selected in #5 or if the condition in #6 is hit, it should not
	result in the mirror being resized or the 'm/M' attribute being changed.
	
	NOTE:  A mirror created with '--nosync' behaves differently than one created
	without it when performing an extension.  The former cannot be extended when
	the mirror is recovering (unless in-active), while the latter can.  This is
	a reasonable thing to do since recovery of a mirror doesn't take long (at
	least in the case of an on-disk log) and it would cause far more time in
	degraded mode if the extension w/o '--nosync' was allowed.  It might be
	reasonable to add the ability to force the operation in the future.  This
	should /not/ force a nosync extension, but rather force a sync'ed extension.
	IOW, the user would be saying, "Yes, yes... I know recovery won't take long
	and that I'll be adding significantly to the time spent in degraded mode, but
	I need the extra space right now!".

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2149&r2=1.2150
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.293&r2=1.294
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.162&r2=1.163
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.138&r2=1.139

--- LVM2/WHATS_NEW	2011/10/06 14:55:39	1.2149
+++ LVM2/WHATS_NEW	2011/10/06 15:32:26	1.2150
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Add ability to extend mirrors with '--nosync' option.
   Fix splitmirror in cluster having different DM/LVM views of storage.
   Fix improper udev settings during suspend/resume for mirror sub-LVs.
   Fix vgsplit when there are mirrors that have mirrored logs.
--- LVM2/lib/metadata/lv_manip.c	2011/10/03 18:43:39	1.293
+++ LVM2/lib/metadata/lv_manip.c	2011/10/06 15:32:26	1.294
@@ -2599,10 +2599,11 @@
 			return 0;
 		}
 
-		r = _lv_extend_layered_lv(ah, lv, extents, 0,
-					  stripes, stripe_size);
+		if (!(r = _lv_extend_layered_lv(ah, lv, extents, 0,
+						stripes, stripe_size)))
+			goto out;
 
-		if (r && segtype_is_thin_pool(segtype)) {
+		if (segtype_is_thin_pool(segtype)) {
 			/* FIXME: resize metadata size here for now */
 			struct logical_volume *tmeta = first_seg(lv)->pool_metadata_lv;
 			if ((r = lv_add_segment(ah, ah->area_count, 1, tmeta,
@@ -2613,7 +2614,52 @@
 			} else
 				stack;
 		}
+
+		/*
+		 * If we are expanding an existing mirror, we can skip the
+		 * resync of the extension if the LV is currently in-sync
+		 * and the LV has the LV_NOTSYNCED flag set.
+		 */
+		if ((lv->le_count != extents) &&
+		    segtype_is_mirrored(segtype) &&
+		    (lv->status & LV_NOTSYNCED)) {
+			percent_t sync_percent = PERCENT_INVALID;
+
+			if (!lv_is_active(lv)) {
+				log_print("%s/%s is not active."
+					  "  Unable to get sync percent.",
+					  lv->vg->name, lv->name);
+				if (yes_no_prompt("Do full resync of extended "
+						  "portion of %s/%s?  [y/n]: ",
+						  lv->vg->name, lv->name) == 'y')
+					goto out;
+				r = 0;
+				goto out;
+			}
+
+			r = 0;
+			if (!lv_mirror_percent(lv->vg->cmd, lv, 0,
+					       &sync_percent, NULL)) {
+				log_error("Failed to get sync percent for %s/%s",
+					  lv->vg->name, lv->name);
+				goto out;
+			} else if (sync_percent == PERCENT_100) {
+				log_verbose("Skipping initial resync for "
+					    "extended portion of %s/%s",
+					    lv->vg->name, lv->name);
+				init_mirror_in_sync(1);
+				lv->status |= LV_NOTSYNCED;
+			} else {
+				log_error("%s/%s cannot be extended while"
+					  " it is recovering.",
+					  lv->vg->name, lv->name);
+				goto out;
+			}
+			r = 1;
+		}
 	}
+
+out:
 	alloc_destroy(ah);
 	return r;
 }
--- LVM2/tools/commands.h	2011/09/06 00:26:43	1.162
+++ LVM2/tools/commands.h	2011/10/06 15:32:27	1.163
@@ -265,6 +265,7 @@
    "\t{-l|--extents [+]LogicalExtentsNumber[%{VG|LV|PVS|FREE|ORIGIN}] |\n"
    "\t -L|--size [+]LogicalVolumeSize[bBsSkKmMgGtTpPeE]}\n"
    "\t[-m|--mirrors Mirrors]\n"
+   "\t[--nosync]\n"
    "\t[--use-policies]\n"
    "\t[-n|--nofsck]\n"
    "\t[--noudevsync]\n"
@@ -276,7 +277,7 @@
    "\tLogicalVolume[Path] [ PhysicalVolumePath... ]\n",
 
    alloc_ARG, autobackup_ARG, extents_ARG, force_ARG, mirrors_ARG,
-   nofsck_ARG, noudevsync_ARG, resizefs_ARG, size_ARG, stripes_ARG,
+   nofsck_ARG, nosync_ARG, noudevsync_ARG, resizefs_ARG, size_ARG, stripes_ARG,
    stripesize_ARG, test_ARG, type_ARG, use_policies_ARG)
 
 xx(lvmchange,
--- LVM2/tools/lvresize.c	2011/09/21 10:39:47	1.138
+++ LVM2/tools/lvresize.c	2011/10/06 15:32:27	1.139
@@ -504,6 +504,13 @@
 
 	/* If extending, find mirrors of last segment */
 	if ((lp->extents > lv->le_count)) {
+		/*
+		 * Has the user specified that they would like the additional
+		 * extents of a mirror not to have an initial sync?
+		 */
+		if (seg_is_mirrored(first_seg(lv)) && arg_count(cmd, nosync_ARG))
+			lv->status |= LV_NOTSYNCED;
+
 		dm_list_iterate_back_items(mirr_seg, &lv->segments) {
 			if (seg_is_mirrored(mirr_seg))
 				seg_mirrors = lv_mirror_count(mirr_seg->lv);


^ permalink raw reply	[flat|nested] 8+ messages in thread

* LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ...
@ 2012-01-20 22:03 snitzer
  0 siblings, 0 replies; 8+ messages in thread
From: snitzer @ 2012-01-20 22:03 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer@sourceware.org	2012-01-20 22:03:49

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c 
	tools          : lvconvert.c 

Log message:
	Allow removal of an invalid snapshot that was to be merged on next activation.
	
	Don't allow a user to merge an invalid snapshot.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2231&r2=1.2232
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.343&r2=1.344
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.178&r2=1.179

--- LVM2/WHATS_NEW	2012/01/20 22:03:03	1.2231
+++ LVM2/WHATS_NEW	2012/01/20 22:03:48	1.2232
@@ -1,5 +1,7 @@
 Version 2.02.89 - 
 ==================================
+  Allow removal of an invalid snapshot that was to be merged on next activation.
+  Don't allow a user to merge an invalid snapshot.
   Use m and M lv_attr to indicate that a snapshot merge failed in lvs.
   Differentiate between snapshot status of "Invalid" and "Merge failed".
   Lookup snapshot usage percent of origin volume when a snapshot is merging.
--- LVM2/lib/metadata/lv_manip.c	2012/01/19 15:39:41	1.343
+++ LVM2/lib/metadata/lv_manip.c	2012/01/20 22:03:48	1.344
@@ -3263,15 +3263,27 @@
 int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *lv,
 				const force_t force, unsigned level)
 {
+	percent_t snap_percent;
 	struct dm_list *snh, *snht;
 	struct seg_list *sl, *tsl;
+	struct lvinfo info;
 
 	if (lv_is_cow(lv)) {
-		/* A merging snapshot cannot be removed directly */
+		/*
+		 * A merging snapshot cannot be removed directly unless
+		 * it has been invalidated.
+		 */
 		if (lv_is_merging_cow(lv) && !level) {
-			log_error("Can't remove merging snapshot logical volume \"%s\"",
-				  lv->name);
-			return 0;
+			if (lv_info(lv->vg->cmd, lv, 0, &info, 1, 0) &&
+			    info.exists && info.live_table) {
+				if (lv_snapshot_percent(lv, &snap_percent) &&
+				    ((snap_percent != PERCENT_INVALID) &&
+				     (snap_percent != PERCENT_MERGE_FAILED))) {
+					log_error("Can't remove merging snapshot logical volume \"%s\"",
+						  lv->name);
+					return 0;
+				}
+			}
 		}
 	}
 
--- LVM2/tools/lvconvert.c	2012/01/20 22:02:05	1.178
+++ LVM2/tools/lvconvert.c	2012/01/20 22:03:48	1.179
@@ -1709,6 +1709,8 @@
 {
 	struct lvconvert_params *lp = handle;
 	struct dm_list *failed_pvs;
+	struct lvinfo info;
+	percent_t snap_percent;
 
 	if (lv->status & LOCKED) {
 		log_error("Cannot convert locked LV %s", lv->name);
@@ -1742,6 +1744,13 @@
 				  lv->name);
 			return ECMD_FAILED;
 		}
+	        if (lv_info(lv->vg->cmd, lv, 0, &info, 1, 0)
+		    && info.exists && info.live_table &&
+		    (!lv_snapshot_percent(lv, &snap_percent) ||
+		     snap_percent == PERCENT_INVALID)) {
+			log_error("Unable to merge invalidated snapshot LV \"%s\"", lv->name);
+			return ECMD_FAILED;
+		}
 		if (!archive(lv->vg)) {
 			stack;
 			return ECMD_FAILED;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ...
@ 2009-05-27 18:19 agk
  0 siblings, 0 replies; 8+ messages in thread
From: agk @ 2009-05-27 18:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2009-05-27 18:19:21

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c 
	tools          : lvchange.c lvcreate.c toollib.c 

Log message:
	Suppress 'removed' messages displayed when internal LVs are removed.
	Fix lvchange -a and -p for sparse LVs.
	Fix lvcreate --virtualsize to activate the new device immediately.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1128&r2=1.1129
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.174&r2=1.175
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.101&r2=1.102
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.191&r2=1.192
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.154&r2=1.155

--- LVM2/WHATS_NEW	2009/05/27 16:30:29	1.1128
+++ LVM2/WHATS_NEW	2009/05/27 18:19:21	1.1129
@@ -1,8 +1,11 @@
 Version 2.02.48 - 
 ===============================
+  Suppress 'removed' messages displayed when internal LVs are removed.
+  Fix lvchange -a and -p for sparse LVs.
+  Fix lvcreate --virtualsize to activate the new device immediately.
   Make --snapshot optional with lvcreate --virtualsize.
   Generalise --virtualoriginsize to --virtualsize.
-  Skip virtual origins in process_each_lv_in_vg().
+  Skip virtual origins in process_each_lv_in_vg() without --all.
   Fix counting of virtual origin LVs in vg_validate.
   Attempt to load dm-zero module if zero target needed but not present.
 
--- LVM2/lib/metadata/lv_manip.c	2009/05/21 03:04:53	1.174
+++ LVM2/lib/metadata/lv_manip.c	2009/05/27 18:19:21	1.175
@@ -2037,6 +2037,7 @@
 		}
 
 		if (lv_is_active(lv) && (force == PROMPT) &&
+		    lv_is_visible(lv) &&
 		    yes_no_prompt("Do you really want to remove active "
 				  "%slogical volume %s? [y/n]: ",
 				  vg_is_clustered(vg) ? "clustered " : "",
@@ -2083,7 +2084,9 @@
 			log_error("Failed to resume %s.", origin->name);
 	}
 
-	log_print("Logical volume \"%s\" successfully removed", lv->name);
+	if (lv_is_visible(lv))
+		log_print("Logical volume \"%s\" successfully removed", lv->name);
+
 	return 1;
 }
 
--- LVM2/tools/lvchange.c	2009/05/20 09:55:34	1.101
+++ LVM2/tools/lvchange.c	2009/05/27 18:19:21	1.102
@@ -540,6 +540,7 @@
 {
 	int doit = 0, docmds = 0;
 	int archived = 0;
+	struct logical_volume *origin;
 
 	if (!(lv->vg->status & LVM_WRITE) &&
 	    (arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
@@ -584,7 +585,12 @@
 		return ECMD_FAILED;
 	}
 
-	if (!(lv_is_visible(lv))) {
+	/* If LV is sparse, activate origin instead */
+	if (arg_count(cmd, available_ARG) && lv_is_cow(lv) &&
+	    lv_is_virtual_origin(origin = origin_from_cow(lv)))
+		lv = origin;
+
+	if (!(lv_is_visible(lv)) && !lv_is_virtual_origin(lv)) {
 		log_error("Unable to change internal LV %s directly",
 			  lv->name);
 		return ECMD_FAILED;
--- LVM2/tools/lvcreate.c	2009/05/27 16:30:30	1.191
+++ LVM2/tools/lvcreate.c	2009/05/27 18:19:21	1.192
@@ -910,12 +910,16 @@
 			return 0;
 		}
 
+		/* A virtual origin must be activated explicitly. */
 		if (lp->voriginsize &&
-		    !(org = _create_virtual_origin(cmd, vg, lv->name,
-						   lp->permission,
-						   lp->voriginextents))) {
+		    (!(org = _create_virtual_origin(cmd, vg, lv->name,
+						    lp->permission,
+						    lp->voriginextents)) ||
+		     !activate_lv(cmd, org))) {
 			log_error("Couldn't create virtual origin for LV %s",
 				  lv->name);
+			if (org && !lv_remove(org))
+				stack;
 			goto deactivate_and_revert_new_lv;
 		}
 
--- LVM2/tools/toollib.c	2009/05/27 13:23:42	1.154
+++ LVM2/tools/toollib.c	2009/05/27 18:19:21	1.155
@@ -122,7 +122,7 @@
 		if (lvl->lv->status & SNAPSHOT)
 			continue;
 
-		if (lv_is_virtual_origin(lvl->lv))
+		if (lv_is_virtual_origin(lvl->lv) && !arg_count(cmd, all_ARG))
 			continue;
 
 		/* Should we process this LV? */


^ permalink raw reply	[flat|nested] 8+ messages in thread

* LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ...
@ 2009-05-20  9:55 mbroz
  0 siblings, 0 replies; 8+ messages in thread
From: mbroz @ 2009-05-20  9:55 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-05-20 09:55:34

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c 
	tools          : lvchange.c 

Log message:
	Use lock query instead of activate_lv_excl
	
	- switch lvremove to not force activate volume when removing
	- ditto for force resync
	
	- fix some wrong return codes in lvchange_resync()

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1117&r2=1.1118
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.172&r2=1.173
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.100&r2=1.101

--- LVM2/WHATS_NEW	2009/05/20 09:52:37	1.1117
+++ LVM2/WHATS_NEW	2009/05/20 09:55:33	1.1118
@@ -1,5 +1,6 @@
 Version 2.02.46 - 
 ================================
+  Use lock query instead of activate_lv_excl.
   Enable online resizing of mirrors.
   Use suspend with flush when device size was changed during table preload.
   Introduce CLVMD_CMD_LOCK_QUERY command for clvmd.
--- LVM2/lib/metadata/lv_manip.c	2009/05/13 21:29:10	1.172
+++ LVM2/lib/metadata/lv_manip.c	2009/05/20 09:55:34	1.173
@@ -2036,28 +2036,13 @@
 			return 0;
 		}
 
-		/*
-		 * Check for confirmation prompts in the following cases:
-		 * 1) Clustered VG, and some remote nodes have the LV active
-		 * 2) Non-clustered VG, but LV active locally
-		 */
-		if (vg_is_clustered(vg) && !activate_lv_excl(cmd, lv) &&
-		    (force == PROMPT)) {
-			if (yes_no_prompt("Logical volume \"%s\" is active on other "
-					  "cluster nodes.  Really remove? [y/n]: ",
-					  lv->name) == 'n') {
-				log_print("Logical volume \"%s\" not removed",
-					  lv->name);
-				return 0;
-			}
-		} else if (info.exists && (force == PROMPT)) {
-			 if (yes_no_prompt("Do you really want to remove active "
-					   "logical volume \"%s\"? [y/n]: ",
-					   lv->name) == 'n') {
-				log_print("Logical volume \"%s\" not removed",
-					  lv->name);
-				return 0;
-			 }
+		if (lv_is_active(lv) && (force == PROMPT) &&
+		    yes_no_prompt("Do you really want to remove active "
+				  "%slogical volume %s? [y/n]: ",
+				  vg_is_clustered(vg) ? "clustered " : "",
+				  lv->name) == 'n') {
+			log_print("Logical volume %s not removed", lv->name);
+			return 0;
 		}
 	}
 
--- LVM2/tools/lvchange.c	2009/05/13 21:27:44	1.100
+++ LVM2/tools/lvchange.c	2009/05/20 09:55:34	1.101
@@ -201,7 +201,7 @@
 		if (info.open_count) {
 			log_error("Can't resync open logical volume \"%s\"",
 				  lv->name);
-			return ECMD_FAILED;
+			return 0;
 		}
 
 		if (info.exists) {
@@ -211,11 +211,11 @@
 					  lv->name) == 'n') {
 				log_print("Logical volume \"%s\" not resynced",
 					  lv->name);
-				return ECMD_FAILED;
+				return 0;
 			}
 
 			if (sigint_caught())
-				return ECMD_FAILED;
+				return 0;
 
 			active = 1;
 		}
@@ -225,17 +225,17 @@
 	monitored = dmeventd_monitor_mode();
 	init_dmeventd_monitor(0);
 
-	if (vg_is_clustered(lv->vg) && !activate_lv_excl(cmd, lv)) {
-		log_error("Can't get exclusive access to clustered volume %s",
-			  lv->name);
-		return ECMD_FAILED;
-	}
-
 	if (!deactivate_lv(cmd, lv)) {
 		log_error("Unable to deactivate %s for resync", lv->name);
 		return 0;
 	}
 
+	if (vg_is_clustered(lv->vg) && lv_is_active(lv)) {
+		log_error("Can't get exclusive access to clustered volume %s",
+			  lv->name);
+		return 0;
+	}
+
 	init_dmeventd_monitor(monitored);
 
 	log_lv = first_seg(lv)->log_lv;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ...
@ 2006-09-11 14:25 agk
  0 siblings, 0 replies; 8+ messages in thread
From: agk @ 2006-09-11 14:25 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-09-11 14:24:58

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c 
	tools          : toollib.c 

Log message:
	Fix several incorrect comparisons in parallel area avoidance code.
	Fix segment lengths when flattening existing parallel areas.
	Log existing parallel areas prior to allocation.
	Fix mirror log creation when activation disabled.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.436&r2=1.437
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.100&r2=1.101
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88

--- LVM2/WHATS_NEW	2006/09/07 23:23:45	1.436
+++ LVM2/WHATS_NEW	2006/09/11 14:24:58	1.437
@@ -1,5 +1,9 @@
 Version 2.02.10 - 
 ==================================
+  Fix several incorrect comparisons in parallel area avoidance code.
+  Fix segment lengths when flattening existing parallel areas.
+  Log existing parallel areas prior to allocation.
+  Fix mirror log creation when activation disabled.
   Don't attempt automatic recovery without proper locking.
   When using local file locking, skip clustered VGs.
   Add fallback_to_clustered_locking and fallback_to_local_locking parameters.
--- LVM2/lib/metadata/lv_manip.c	2006/08/21 12:54:53	1.100
+++ LVM2/lib/metadata/lv_manip.c	2006/09/11 14:24:58	1.101
@@ -158,7 +158,7 @@
 	}
 
 	if (seg_lv(seg, s)->status & MIRROR_IMAGE) {
-		lv_reduce(seg_lv(seg, s), area_reduction);	
+		lv_reduce(seg_lv(seg, s), area_reduction);
 		return;
 	}
 
@@ -490,6 +490,49 @@
 		dm_pool_destroy(ah->mem);
 }
 
+static int _log_parallel_areas(struct dm_pool *mem, struct list *parallel_areas)
+{
+	struct seg_pvs *spvs;
+	struct pv_list *pvl;
+	char *pvnames;
+
+	if (!parallel_areas)
+		return 1;
+
+	if (!dm_pool_begin_object(mem, 256)) {
+		log_error("dm_pool_begin_object failed");
+		return 0;
+	}
+
+	list_iterate_items(spvs, parallel_areas) {
+		list_iterate_items(pvl, &spvs->pvs) {
+			if (!dm_pool_grow_object(mem, dev_name(pvl->pv->dev), strlen(dev_name(pvl->pv->dev)))) {
+				log_error("dm_pool_grow_object failed");
+				dm_pool_abandon_object(mem);
+				return 0;
+			}
+			if (!dm_pool_grow_object(mem, " ", 1)) {
+				log_error("dm_pool_grow_object failed");
+				dm_pool_abandon_object(mem);
+				return 0;
+			}
+		}
+
+		if (!dm_pool_grow_object(mem, "\0", 1)) {
+			log_error("dm_pool_grow_object failed");
+			dm_pool_abandon_object(mem);
+			return 0;
+		}
+
+		pvnames = dm_pool_end_object(mem);
+		log_debug("Parallel PVs at LE %" PRIu32 " length %" PRIu32 ": %s",
+			  spvs->le, spvs->len, pvnames);
+		dm_pool_free(mem, pvnames);
+	}
+
+	return 1;
+}
+
 static int _setup_alloced_segment(struct logical_volume *lv, uint32_t status,
 				  uint32_t area_count,
 				  uint32_t stripe_size,
@@ -711,14 +754,15 @@
 		 * the maximum we can allocate in one go accordingly.
 		 */
 		if (ah->parallel_areas) {
+			next_le = (prev_lvseg ? prev_lvseg->le + prev_lvseg->len : 0) + *allocated / ah->area_multiple;
 			list_iterate_items(spvs, ah->parallel_areas) {
-				next_le = (prev_lvseg ? prev_lvseg->le + prev_lvseg->len : 0) + *allocated;
-				if (next_le >= spvs->le) {
-					if (next_le + max_parallel > spvs->le + spvs->len)
-						max_parallel = (spvs->le + spvs->len - next_le) * ah->area_multiple;
-					parallel_pvs = &spvs->pvs;
-					break;
-				}
+				if (next_le >= spvs->le + spvs->len)
+					continue;
+
+				if (max_parallel > (spvs->le + spvs->len) * ah->area_multiple)
+					max_parallel = (spvs->le + spvs->len) * ah->area_multiple;
+				parallel_pvs = &spvs->pvs;
+				break;
 			}
 		}
 
@@ -760,7 +804,8 @@
 				}
 
 				/* Is it big enough on its own? */
-				if ((pva->count < max_parallel - *allocated) &&
+				if (pva->count * ah->area_multiple <
+				    max_parallel - *allocated &&
 				    ((!can_split && !ah->log_count) ||
 				     (already_found_one &&
 				      !(alloc == ALLOC_ANYWHERE))))
@@ -853,6 +898,9 @@
 		return 0;
 	}
 
+	if (!_log_parallel_areas(ah->mem, ah->parallel_areas))
+		stack;
+
 	areas_size = list_size(pvms);
 	if (areas_size < ah->area_count + ah->log_count) {
 		if (ah->alloc != ALLOC_ANYWHERE) {
@@ -1213,7 +1261,7 @@
 				log_error("Aborting. Failed to extend %s.",
 					  seg_lv(seg, m)->name);
 				return 0;
-                	}
+			}
 		}
 		seg->area_len += extents;
 		seg->len += extents;
@@ -1345,7 +1393,7 @@
 	/* Remaining logical length of segment */
 	remaining_seg_len = seg->len - (le - seg->le);
 
-	if (len > remaining_seg_len)
+	if (remaining_seg_len > len)
 		remaining_seg_len = len;
 
 	if (spvs->len > remaining_seg_len)
@@ -1426,7 +1474,7 @@
 
 		/* Find next segment end */
 		/* FIXME Unnecessary nesting! */
-		if (!_for_each_pv(cmd, lv, current_le, lv->le_count, _add_pvs, spvs)) {
+		if (!_for_each_pv(cmd, lv, current_le, lv->le_count - current_le, _add_pvs, spvs)) {
 			stack;
 			return NULL;
 		}
--- LVM2/tools/toollib.c	2006/09/02 01:18:17	1.87
+++ LVM2/tools/toollib.c	2006/09/11 14:24:58	1.88
@@ -1204,7 +1204,6 @@
 	return 1;
 }
 
-
 /*
  * This function writes a new header to the mirror log header to the lv
  *
@@ -1301,6 +1300,12 @@
 		goto error;
 	}
 
+	if (!activation() && in_sync) {
+		log_error("Aborting. Unable to create in-sync mirror log "
+			  "while activation is disabled.");
+		goto error;
+	}
+
 	if (!activate_lv(cmd, log_lv)) {
 		log_error("Aborting. Failed to activate mirror log. "
 			  "Remove new LVs and retry.");
@@ -1313,7 +1318,7 @@
 		goto error;
 	}
 
-	if (!_write_log_header(cmd, log_lv)) {
+	if (activation() && !_write_log_header(cmd, log_lv)) {
 		log_error("Aborting. Failed to write mirror log header. "
 			  "Remove new LV and retry.");
 		goto error;


^ permalink raw reply	[flat|nested] 8+ messages in thread

* LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ...
@ 2006-05-11 18:54 agk
  0 siblings, 0 replies; 8+ messages in thread
From: agk @ 2006-05-11 18:54 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-05-11 18:54:04

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c 
	tools          : args.h commands.h lvconvert.c lvcreate.c 

Log message:
	Add --corelog to lvcreate and lvconvert.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.380&r2=1.381
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.98&r2=1.99
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/args.h.diff?cvsroot=lvm2&r1=1.42&r2=1.43
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.81&r2=1.82
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvconvert.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.117&r2=1.118


^ permalink raw reply	[flat|nested] 8+ messages in thread

* LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ...
@ 2005-06-03 19:48 agk
  0 siblings, 0 replies; 8+ messages in thread
From: agk @ 2005-06-03 19:48 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2005-06-03 19:48:20

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c 
	tools          : commands.h lvcreate.c lvresize.c 

Log message:
	Allow mirror images to be resized.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.250&r2=1.251
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.77&r2=1.78
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.71&r2=1.72
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.95&r2=1.96
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.62&r2=1.63


^ permalink raw reply	[flat|nested] 8+ messages in thread

* LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools ...
@ 2005-05-17 13:51 agk
  0 siblings, 0 replies; 8+ messages in thread
From: agk @ 2005-05-17 13:51 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2005-05-17 13:49:45

Modified files:
	.              : WHATS_NEW 
	lib/metadata   : lv_manip.c 
	tools          : lvcreate.c 

Log message:
	Start merging cloned allocation functions.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.244&r2=1.245
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.92&r2=1.93


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-01-20 22:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-06 15:32 LVM2 ./WHATS_NEW lib/metadata/lv_manip.c tools jbrassow
  -- strict thread matches above, loose matches on Subject: below --
2012-01-20 22:03 snitzer
2009-05-27 18:19 agk
2009-05-20  9:55 mbroz
2006-09-11 14:25 agk
2006-05-11 18:54 agk
2005-06-03 19:48 agk
2005-05-17 13:51 agk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).