diff options
author | NeilBrown <neilb@suse.de> | 2006-10-28 10:38:30 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-28 11:30:51 -0700 |
commit | 01ab5662f573fe3a6bcefa200f15ab3069cec8a3 (patch) | |
tree | 6a3280e26f6f65673394dc8ab3b39897d1c11c18 /drivers/md/md.c | |
parent | 2b6e845986347ef86729e8651908af3e8a8441f5 (diff) | |
download | linux-3.10-01ab5662f573fe3a6bcefa200f15ab3069cec8a3.tar.gz linux-3.10-01ab5662f573fe3a6bcefa200f15ab3069cec8a3.tar.bz2 linux-3.10-01ab5662f573fe3a6bcefa200f15ab3069cec8a3.zip |
[PATCH] md: simplify checking of available size when resizing an array
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.
We 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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index c40ce9f9cc9..50ab4a936e3 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -4045,11 +4045,8 @@ static int update_size(mddev_t *mddev, unsigned long size) 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)) |