[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>
This commit is contained in:
parent
2b6e845986
commit
01ab5662f5
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue