[PATCH 002 of 3] md: Fix md grow/size code to correctly find the maximum available space.

From: NeilBrown
Date: Fri Mar 24 2006 - 00:59:23 EST



An md array can be asked to change the amount of each device that it
is using, and in particular can be asked to use the maximum available
space. This currently only works if the first device is not larger
than the rest. As 'size' gets changed and so 'fit' becomes wrong.
So check if a 'fit' is required early and don't corrupt it.

Signed-off-by: Doug Ledford <dledford@xxxxxxxxxx>
Signed-off-by: Neil Brown <neilb@xxxxxxx>

### Diffstat output
./drivers/md/md.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff ./drivers/md/md.c~current~ ./drivers/md/md.c
--- ./drivers/md/md.c~current~ 2006-03-24 14:01:30.000000000 +1100
+++ ./drivers/md/md.c 2006-03-24 14:06:49.000000000 +1100
@@ -3575,6 +3575,7 @@ static int update_size(mddev_t *mddev, u
mdk_rdev_t * rdev;
int rv;
struct list_head *tmp;
+ int fit = (size == 0);

if (mddev->pers->resize == NULL)
return -EINVAL;
@@ -3592,7 +3593,6 @@ static int update_size(mddev_t *mddev, u
return -EBUSY;
ITERATE_RDEV(mddev,rdev,tmp) {
sector_t avail;
- int fit = (size == 0);
if (rdev->sb_offset > rdev->data_offset)
avail = (rdev->sb_offset*2) - rdev->data_offset;
else
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/