All of lore.kernel.org
 help / color / mirror / Atom feed
From: agk@sourceware.org <agk@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/tools lvresize.c
Date: 12 Apr 2012 15:11:21 -0000	[thread overview]
Message-ID: <20120412151121.2204.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk at sourceware.org	2012-04-12 15:11:21

Modified files:
	tools          : lvresize.c 

Log message:
	Remove 'up' from rounding message that sometimes rounds down.
	Detect reduction of 0 after rounding for stripes and avoid warning of potential data loss.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvresize.c.diff?cvsroot=lvm2&r1=1.154&r2=1.155

--- LVM2/tools/lvresize.c	2012/04/11 12:40:04	1.154
+++ LVM2/tools/lvresize.c	2012/04/12 15:11:21	1.155
@@ -454,6 +454,12 @@
 
 	alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, lv->alloc);
 
+	/*
+	 * First adjust to an exact multiple of extent size.
+	 * When extending by a relative amount we round that amount up.
+	 * When reducing by a relative amount we remove at most that amount.
+	 * When changing to an absolute size, we round that size up.
+	 */
 	if (lp->size) {
 		if (lp->size % vg->extent_size) {
 			if (lp->sign == SIGN_MINUS)
@@ -462,7 +468,7 @@
 				lp->size += vg->extent_size -
 				    (lp->size % vg->extent_size);
 
-			log_print("Rounding up size to full physical extent %s",
+			log_print("Rounding size to boundary between physical extents: %s",
 				  display_size(cmd, lp->size));
 		}
 
@@ -714,6 +720,15 @@
 			return EINVALID_CMD_LINE;
 		}
 		lp->resize = LV_EXTEND;
+	} else if (lp->extents == lv->le_count) {
+		if (use_policy)
+			return ECMD_PROCESSED; /* Nothing to do. */
+		if (!lp->resizefs) {
+			log_error("New size (%d extents) matches existing size "
+				  "(%d extents)", lp->extents, lv->le_count);
+			return EINVALID_CMD_LINE;
+		}
+		lp->resize = LV_EXTEND;
 	}
 
 	if (lv_is_origin(lv)) {



             reply	other threads:[~2012-04-12 15:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-12 15:11 agk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-04-11 12:30 LVM2/tools lvresize.c zkabelac
2011-11-08 12:19 zkabelac
2011-06-15 10:56 mbroz
2009-02-28 19:43 agk
2009-02-27 23:55 agk
2007-09-06 22:35 wysochanski
2007-09-06 21:08 wysochanski

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=20120412151121.2204.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.