linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 002 of 4] md: Simplify checking of available size when resizing an array
Date: Mon, 23 Oct 2006 17:07:54 +1000	[thread overview]
Message-ID: <1061023070754.29236@suse.de> (raw)
In-Reply-To: 20061023170347.29132.patches@notabene


When "mdadm --grow --size=xxx" is used to resize an array (use more or
less of each device), we check the new siza against the available
space in each device.

The already have that number recorded in rdev->size, so calculating it
is pointless (and wrong in one obscure case).

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/md.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c	2006-10-23 16:35:05.000000000 +1000
+++ ./drivers/md/md.c	2006-10-23 16:35:21.000000000 +1000
@@ -4047,11 +4047,8 @@ static int update_size(mddev_t *mddev, u
 		return -EBUSY;
 	ITERATE_RDEV(mddev,rdev,tmp) {
 		sector_t avail;
-		if (rdev->sb_offset > rdev->data_offset)
-			avail = (rdev->sb_offset*2) - rdev->data_offset;
-		else
-			avail = get_capacity(rdev->bdev->bd_disk)
-				- rdev->data_offset;
+		avail = rdev->size * 2;
+
 		if (fit && (size == 0 || size > avail/2))
 			size = avail/2;
 		if (avail < ((sector_t)size << 1))

  parent reply	other threads:[~2006-10-23  7:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-23  7:07 [PATCH 000 of 4] md: assorted bugfixes - one serious NeilBrown
2006-10-23  7:07 ` [PATCH 001 of 4] md: Fix bug where spares don't always get rebuilt properly when they become live NeilBrown
2006-10-23  7:07 ` NeilBrown [this message]
2006-10-23  7:08 ` [PATCH 003 of 4] md: Fix up maintenance of ->degraded in multipath NeilBrown
2006-10-23  7:08 ` [PATCH 004 of 4] md: Fix printk format warnings, seen on powerpc64: NeilBrown

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=1061023070754.29236@suse.de \
    --to=neilb@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.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 NNTP newsgroup(s).