public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: mbroz@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW test/t-lvextend-percent-exten ...
Date: Thu, 09 Jun 2011 19:34:00 -0000	[thread overview]
Message-ID: <20110609193450.15452.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2011-06-09 19:34:50

Modified files:
	.              : WHATS_NEW 
	test           : t-lvextend-percent-extents.sh 
	tools          : lvresize.c 

Log message:
	Fix extent rounding for striped segments.
	
	We should never remove more extents than requested by user,
	so round up to next stripe boundary during lvreduce.
	
	Also this fixes round to zero sized LV bug:
	
	# lvcreate -i2 -I 64k -l10 -n lvs vg_test
	# lvreduce -f -l1 vg_test/lvs
	Rounding size (1 extents) down to stripe boundary size for segment (0 extents)
	WARNING: Reducing active logical volume to 0
	THIS MAY DESTROY YOUR DATA (filesystem etc.)
	Reducing logical volume lvs to 0
	Failed to suspend lvs

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2007&r2=1.2008
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/t-lvextend-percent-extents.sh.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.130&r2=1.131

--- LVM2/WHATS_NEW	2011/06/08 08:49:53	1.2007
+++ LVM2/WHATS_NEW	2011/06/09 19:34:49	1.2008
@@ -1,5 +1,6 @@
 Version 2.02.86 -  
 =================================
+  Fix extent rounding for striped volumes (never reduce more than requested).
   Fix create_temp_name to replace any '/' found in the hostname with '?'.
   Always use append to file in lvmdump (selinux policy - no file truncation).
   Propagate test mode to clvmd to skip activation and changes to held locks.
--- LVM2/test/t-lvextend-percent-extents.sh	2011/01/05 00:16:20	1.10
+++ LVM2/test/t-lvextend-percent-extents.sh	2011/06/09 19:34:49	1.11
@@ -99,3 +99,8 @@
 lvreduce -f -l -$(( $pe_count * 1 )) $vg/$lv
 check lv_field $vg/$lv seg_count 1
 
+# do not reduce to 0 extents
+lvremove -f $vg/$lv
+lvcreate -i2 -I 64k -l10 -n $lv $vg
+lvreduce -f -l1 $vg/$lv
+check lv_field $vg/$lv lv_size "8.00m"
--- LVM2/tools/lvresize.c	2011/04/06 21:32:21	1.130
+++ LVM2/tools/lvresize.c	2011/06/09 19:34:50	1.131
@@ -575,11 +575,17 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	if ((lp->stripes > 1)) {
+	if (lp->stripes > 1) {
 		if (!(stripesize_extents = lp->stripe_size / vg->extent_size))
 			stripesize_extents = 1;
 
-		if ((size_rest = seg_size % (lp->stripes * stripesize_extents))) {
+		size_rest = seg_size % (lp->stripes * stripesize_extents);
+		if (size_rest && lp->resize == LV_REDUCE) {
+			log_print("Rounding size (%d extents) up to stripe "
+				  "boundary size for segment (%d extents)",
+				  lp->extents, lp->extents + size_rest);
+			lp->extents = lp->extents + size_rest;
+		} else if (size_rest) {
 			log_print("Rounding size (%d extents) down to stripe "
 				  "boundary size for segment (%d extents)",
 				  lp->extents, lp->extents - size_rest);


                 reply	other threads:[~2011-06-09 19:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110609193450.15452.qmail@sourceware.org \
    --to=mbroz@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).