aboutsummaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-12-15 01:48:58 +0100
committerAdrian Bunk <bunk@stusta.de>2006-12-15 01:48:58 +0100
commit75ba82c65d55099a0af5aba1075f8bdcaf566b56 (patch)
tree0771aa37ad875067eecf8157c5b4fe8099c74b3a /drivers/md
parente89da8fc50c416abf4abab77d851e051df0edbec (diff)
md: Fix md grow/size code to correctly find the maximum available space
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@redhat.com> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 78cca0c4e95..2fd2cd4470a 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3437,6 +3437,7 @@ static int update_size(mddev_t *mddev, unsigned long size)
mdk_rdev_t * rdev;
int rv;
struct list_head *tmp;
+ int fit = (size == 0);
if (mddev->pers->resize == NULL)
return -EINVAL;
@@ -3454,7 +3455,6 @@ static int update_size(mddev_t *mddev, unsigned long size)
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