Commit 01ab5662 authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

[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: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2b6e8459
...@@ -4045,11 +4045,8 @@ static int update_size(mddev_t *mddev, unsigned long size) ...@@ -4045,11 +4045,8 @@ static int update_size(mddev_t *mddev, unsigned long size)
return -EBUSY; return -EBUSY;
ITERATE_RDEV(mddev,rdev,tmp) { ITERATE_RDEV(mddev,rdev,tmp) {
sector_t avail; sector_t avail;
if (rdev->sb_offset > rdev->data_offset) avail = rdev->size * 2;
avail = (rdev->sb_offset*2) - rdev->data_offset;
else
avail = get_capacity(rdev->bdev->bd_disk)
- rdev->data_offset;
if (fit && (size == 0 || size > avail/2)) if (fit && (size == 0 || size > avail/2))
size = avail/2; size = avail/2;
if (avail < ((sector_t)size << 1)) if (avail < ((sector_t)size << 1))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment