diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2016-06-14 01:46:03 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2016-06-14 18:52:13 -0400 |
commit | 4257e085e26edaba0bf516ea231bd5122e3f3e6f (patch) | |
tree | 1efc21fe533f65c0b62c896d179d28a1acb29878 /drivers/md/dm-raid.c | |
parent | d41bfed091db0bdc2e0b2e847e0773a461f9e225 (diff) | |
download | lwn-4257e085e26edaba0bf516ea231bd5122e3f3e6f.tar.gz lwn-4257e085e26edaba0bf516ea231bd5122e3f3e6f.zip |
dm raid: support to change bitmap region size
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-raid.c')
-rw-r--r-- | drivers/md/dm-raid.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index e4c41232107f..7df450877423 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -217,6 +217,7 @@ struct raid_set { int delta_disks; int data_offset; int raid10_copies; + int requested_bitmap_chunk_sectors; struct mddev md; struct raid_type *raid_type; @@ -1277,6 +1278,7 @@ static int parse_raid_params(struct raid_set *rs, struct dm_arg_set *as, } region_size = value; + rs->requested_bitmap_chunk_sectors = value; } else if (!strcasecmp(key, dm_raid_arg_name_by_flag(CTR_FLAG_RAID10_COPIES))) { if (test_and_set_bit(__CTR_FLAG_RAID10_COPIES, &rs->ctr_flags)) { rs->ti->error = "Only one raid10_copies argument pair allowed"; @@ -3401,6 +3403,15 @@ static int raid_preresume(struct dm_target *ti) if (r) return r; + /* Resize bitmap to adjust to changed region size (aka MD bitmap chunksize) */ + if (test_bit(RT_FLAG_RS_BITMAP_LOADED, &rs->runtime_flags) && + mddev->bitmap_info.chunksize != to_bytes(rs->requested_bitmap_chunk_sectors)) { + r = bitmap_resize(mddev->bitmap, mddev->dev_sectors, + to_bytes(rs->requested_bitmap_chunk_sectors), 0); + if (r) + DMERR("Failed to resize bitmap"); + } + /* Check for any resize/reshape on @rs and adjust/initiate */ /* Be prepared for mddev_resume() in raid_resume() */ set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |