aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-05-21 23:55:27 -0400
committerNeilBrown <neilb@suse.de>2012-05-21 23:55:27 -0400
commita4a6125a074e1b08ee8ae34f700c5bca19eb9d18 (patch)
tree761a719a7d4f1a53d44349f7bef095368a9ae75a /drivers/md/raid1.c
parentb81a040481233e5171cb3fbc62f44636d5ea18b2 (diff)
md: allow array to be resized while bitmap is present.
Now that bitmaps can be resized, we can allow an array to be resized while the bitmap is present. This only covers resizing that involves changing the effective size of member devices, not resizing that changes the number of devices. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 22cfc6660b18..8e717bd518e7 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -2752,9 +2752,16 @@ static int raid1_resize(struct mddev *mddev, sector_t sectors)
2752 * any io in the removed space completes, but it hardly seems 2752 * any io in the removed space completes, but it hardly seems
2753 * worth it. 2753 * worth it.
2754 */ 2754 */
2755 md_set_array_sectors(mddev, raid1_size(mddev, sectors, 0)); 2755 sector_t newsize = raid1_size(mddev, sectors, 0);
2756 if (mddev->array_sectors > raid1_size(mddev, sectors, 0)) 2756 if (mddev->external_size &&
2757 mddev->array_sectors > newsize)
2757 return -EINVAL; 2758 return -EINVAL;
2759 if (mddev->bitmap) {
2760 int ret = bitmap_resize(mddev->bitmap, newsize, 0, 0);
2761 if (ret)
2762 return ret;
2763 }
2764 md_set_array_sectors(mddev, newsize);
2758 set_capacity(mddev->gendisk, mddev->array_sectors); 2765 set_capacity(mddev->gendisk, mddev->array_sectors);
2759 revalidate_disk(mddev->gendisk); 2766 revalidate_disk(mddev->gendisk);
2760 if (sectors > mddev->dev_sectors && 2767 if (sectors > mddev->dev_sectors &&