From: Florian-Ewald Mueller <florian-ewald.mueller@xxxxxxxxx> On bitmap resizing, attempt to reuse the former chunk size (if any) in order to preserve the, ev. on purpose set, chunk size resolution. Signed-off-by: Florian-Ewald Mueller <florian-ewald.mueller@xxxxxxxxx> Signed-off-by: Jack Wang <jinpu.wang@xxxxxxxxx> --- drivers/md/md-cluster.c | 3 ++- drivers/md/raid1.c | 3 ++- drivers/md/raid10.c | 12 ++++++++---- drivers/md/raid5.c | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index 10e0c5381d01..9929631bdc94 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -604,7 +604,8 @@ static int process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg) case BITMAP_RESIZE: if (le64_to_cpu(msg->high) != mddev->pers->size(mddev, 0, 0)) ret = md_bitmap_resize(mddev->bitmap, - le64_to_cpu(msg->high), 0, 0); + le64_to_cpu(msg->high), + mddev->bitmap_info.chunksize, 0); break; default: ret = -1; diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 05d8438cfec8..8f1d25064a53 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -3225,7 +3225,8 @@ static int raid1_resize(struct mddev *mddev, sector_t sectors) mddev->array_sectors > newsize) return -EINVAL; if (mddev->bitmap) { - int ret = md_bitmap_resize(mddev->bitmap, newsize, 0, 0); + int ret = md_bitmap_resize(mddev->bitmap, newsize, + mddev->bitmap_info.chunksize, 0); if (ret) return ret; } diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 3aa8b6e11d58..8f0453b6e0c6 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -4346,7 +4346,8 @@ static int raid10_resize(struct mddev *mddev, sector_t sectors) mddev->array_sectors > size) return -EINVAL; if (mddev->bitmap) { - int ret = md_bitmap_resize(mddev->bitmap, size, 0, 0); + int ret = md_bitmap_resize(mddev->bitmap, size, + mddev->bitmap_info.chunksize, 0); if (ret) return ret; } @@ -4618,7 +4619,8 @@ static int raid10_start_reshape(struct mddev *mddev) newsize = raid10_size(mddev, 0, conf->geo.raid_disks); if (!mddev_is_clustered(mddev)) { - ret = md_bitmap_resize(mddev->bitmap, newsize, 0, 0); + ret = md_bitmap_resize(mddev->bitmap, newsize, + mddev->bitmap_info.chunksize, 0); if (ret) goto abort; else @@ -4640,13 +4642,15 @@ static int raid10_start_reshape(struct mddev *mddev) MD_FEATURE_RESHAPE_ACTIVE)) || (oldsize == newsize)) goto out; - ret = md_bitmap_resize(mddev->bitmap, newsize, 0, 0); + ret = md_bitmap_resize(mddev->bitmap, newsize, + mddev->bitmap_info.chunksize, 0); if (ret) goto abort; ret = md_cluster_ops->resize_bitmaps(mddev, newsize, oldsize); if (ret) { - md_bitmap_resize(mddev->bitmap, oldsize, 0, 0); + md_bitmap_resize(mddev->bitmap, oldsize, + mddev->bitmap_info.chunksize, 0); goto abort; } } diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 7b820b81d8c2..bff7d3d779ae 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -8372,7 +8372,8 @@ static int raid5_resize(struct mddev *mddev, sector_t sectors) mddev->array_sectors > newsize) return -EINVAL; if (mddev->bitmap) { - int ret = md_bitmap_resize(mddev->bitmap, sectors, 0, 0); + int ret = md_bitmap_resize(mddev->bitmap, sectors, + mddev->bitmap_info.chunksize, 0); if (ret) return ret; } -- 2.34.1