aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-03-27 04:18:18 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-27 11:45:03 -0500
commit8ddeeae51f2f197b4fafcba117ee8191b49d843e (patch)
treef18b93cd8d9122dcf9a59cc9ff63d75be146bb11
parentf6344757a92e5466bf8c23a74ee8f972ff35cb05 (diff)
[PATCH] 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: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-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 92fd0104fa04..147efcb1e8ca 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3575,6 +3575,7 @@ static int update_size(mddev_t *mddev, unsigned long size)
3575 mdk_rdev_t * rdev; 3575 mdk_rdev_t * rdev;
3576 int rv; 3576 int rv;
3577 struct list_head *tmp; 3577 struct list_head *tmp;
3578 int fit = (size == 0);
3578 3579
3579 if (mddev->pers->resize == NULL) 3580 if (mddev->pers->resize == NULL)
3580 return -EINVAL; 3581 return -EINVAL;
@@ -3592,7 +3593,6 @@ static int update_size(mddev_t *mddev, unsigned long size)
3592 return -EBUSY; 3593 return -EBUSY;
3593 ITERATE_RDEV(mddev,rdev,tmp) { 3594 ITERATE_RDEV(mddev,rdev,tmp) {
3594 sector_t avail; 3595 sector_t avail;
3595 int fit = (size == 0);
3596 if (rdev->sb_offset > rdev->data_offset) 3596 if (rdev->sb_offset > rdev->data_offset)
3597 avail = (rdev->sb_offset*2) - rdev->data_offset; 3597 avail = (rdev->sb_offset*2) - rdev->data_offset;
3598 else 3598 else