From: Heinz Mauelshagen <heinzm@xxxxxxxxxx> Signed-off-by: heinzm <heinzm@xxxxxxxxxx> --- drivers/md/md.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index ff4699babdd6..132979e597dd 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -2156,28 +2156,29 @@ super_1_rdev_size_change(struct md_rdev *rdev, sector_t num_sectors) max_sectors = bdev_nr_sectors(rdev->bdev) - rdev->data_offset; if (!num_sectors || num_sectors > max_sectors) num_sectors = max_sectors; - } else if (rdev->mddev->bitmap_info.offset) { - /* minor version 0 with bitmap we can't move */ - return 0; } else { - /* minor version 0; superblock after data */ - sector_t sb_start, bm_space; - sector_t dev_size = bdev_nr_sectors(rdev->bdev); + if (!rdev->mddev->bitmap_info.offset) { + /* minor version 0; superblock after data */ + sector_t sb_start, bm_space; + sector_t dev_size = bdev_nr_sectors(rdev->bdev); - /* 8K is for superblock */ - sb_start = dev_size - 8*2; - sb_start &= ~(sector_t)(4*2 - 1); + /* 8K is for superblock */ + sb_start = dev_size - 8*2; + sb_start &= ~(sector_t)(4*2 - 1); - bm_space = super_1_choose_bm_space(dev_size); + bm_space = super_1_choose_bm_space(dev_size); - /* Space that can be used to store date needs to decrease - * superblock bitmap space and bad block space(4K) - */ - max_sectors = sb_start - bm_space - 4*2; + /* Space that can be used to store date needs to decrease + * superblock bitmap space and bad block space(4K) + */ + max_sectors = sb_start - bm_space - 4*2; - if (!num_sectors || num_sectors > max_sectors) - num_sectors = max_sectors; - rdev->sb_start = sb_start; + if (!num_sectors || num_sectors > max_sectors) + num_sectors = max_sectors; + rdev->sb_start = sb_start; + } else + /* minor version 0 with bitmap we can't move */ + return 0; } sb = page_address(rdev->sb_page); sb->data_size = cpu_to_le64(num_sectors); @@ -4608,7 +4609,7 @@ bitmap_store(struct mddev *mddev, const char *buf, size_t len) if (buf == end) break; } - if (*end && !isspace(*end)) + if (*end && !isspace(*end)) break; md_bitmap_dirty_bits(mddev->bitmap, chunk, end_chunk); buf = skip_spaces(end); -- 2.39.2