aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
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
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')
-rw-r--r--drivers/md/md.c6
-rw-r--r--drivers/md/raid1.c11
-rw-r--r--drivers/md/raid10.c10
-rw-r--r--drivers/md/raid5.c14
4 files changed, 28 insertions, 13 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 9e2336fbbd31..86adf4ac46cf 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -6153,11 +6153,7 @@ static int update_size(struct mddev *mddev, sector_t num_sectors)
6153 */ 6153 */
6154 if (mddev->sync_thread) 6154 if (mddev->sync_thread)
6155 return -EBUSY; 6155 return -EBUSY;
6156 if (mddev->bitmap) 6156
6157 /* Sorry, cannot grow a bitmap yet, just remove it,
6158 * grow, and re-add.
6159 */
6160 return -EBUSY;
6161 rdev_for_each(rdev, mddev) { 6157 rdev_for_each(rdev, mddev) {
6162 sector_t avail = rdev->sectors; 6158 sector_t avail = rdev->sectors;
6163 6159
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 &&
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index fb9062b5022c..8fe3aa469987 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3678,9 +3678,15 @@ static int raid10_resize(struct mddev *mddev, sector_t sectors)
3678 3678
3679 oldsize = raid10_size(mddev, 0, 0); 3679 oldsize = raid10_size(mddev, 0, 0);
3680 size = raid10_size(mddev, sectors, 0); 3680 size = raid10_size(mddev, sectors, 0);
3681 md_set_array_sectors(mddev, size); 3681 if (mddev->external_size &&
3682 if (mddev->array_sectors > size) 3682 mddev->array_sectors > size)
3683 return -EINVAL; 3683 return -EINVAL;
3684 if (mddev->bitmap) {
3685 int ret = bitmap_resize(mddev->bitmap, size, 0, 0);
3686 if (ret)
3687 return ret;
3688 }
3689 md_set_array_sectors(mddev, size);
3684 set_capacity(mddev->gendisk, mddev->array_sectors); 3690 set_capacity(mddev->gendisk, mddev->array_sectors);
3685 revalidate_disk(mddev->gendisk); 3691 revalidate_disk(mddev->gendisk);
3686 if (sectors > mddev->dev_sectors && 3692 if (sectors > mddev->dev_sectors &&
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 7bfd59b313d7..eab6168bb7f4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5503,12 +5503,18 @@ static int raid5_resize(struct mddev *mddev, sector_t sectors)
5503 * any io in the removed space completes, but it hardly seems 5503 * any io in the removed space completes, but it hardly seems
5504 * worth it. 5504 * worth it.
5505 */ 5505 */
5506 sector_t newsize;
5506 sectors &= ~((sector_t)mddev->chunk_sectors - 1); 5507 sectors &= ~((sector_t)mddev->chunk_sectors - 1);
5507 md_set_array_sectors(mddev, raid5_size(mddev, sectors, 5508 newsize = raid5_size(mddev, sectors, mddev->raid_disks);
5508 mddev->raid_disks)); 5509 if (mddev->external_size &&
5509 if (mddev->array_sectors > 5510 mddev->array_sectors > newsize)
5510 raid5_size(mddev, sectors, mddev->raid_disks))
5511 return -EINVAL; 5511 return -EINVAL;
5512 if (mddev->bitmap) {
5513 int ret = bitmap_resize(mddev->bitmap, sectors, 0, 0);
5514 if (ret)
5515 return ret;
5516 }
5517 md_set_array_sectors(mddev, newsize);
5512 set_capacity(mddev->gendisk, mddev->array_sectors); 5518 set_capacity(mddev->gendisk, mddev->array_sectors);
5513 revalidate_disk(mddev->gendisk); 5519 revalidate_disk(mddev->gendisk);
5514 if (sectors > mddev->dev_sectors && 5520 if (sectors > mddev->dev_sectors &&