mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-17 17:10:26 -05:00
md/raid5: check before referencing mddev->bitmap_ops
Prepare to introduce CONFIG_MD_BITMAP. Link: https://lore.kernel.org/linux-raid/20250707012711.376844-13-yukuai1@huaweicloud.com Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Xiao Ni <xni@redhat.com>
This commit is contained in:
@@ -6496,7 +6496,8 @@ static inline sector_t raid5_sync_request(struct mddev *mddev, sector_t sector_n
|
||||
&sync_blocks);
|
||||
else /* completed sync */
|
||||
conf->fullsync = 0;
|
||||
mddev->bitmap_ops->close_sync(mddev);
|
||||
if (md_bitmap_enabled(mddev, false))
|
||||
mddev->bitmap_ops->close_sync(mddev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -6534,7 +6535,8 @@ static inline sector_t raid5_sync_request(struct mddev *mddev, sector_t sector_n
|
||||
return sync_blocks * RAID5_STRIPE_SECTORS(conf);
|
||||
}
|
||||
|
||||
mddev->bitmap_ops->cond_end_sync(mddev, sector_nr, false);
|
||||
if (md_bitmap_enabled(mddev, false))
|
||||
mddev->bitmap_ops->cond_end_sync(mddev, sector_nr, false);
|
||||
|
||||
sh = raid5_get_active_stripe(conf, NULL, sector_nr,
|
||||
R5_GAS_NOBLOCK);
|
||||
@@ -6760,7 +6762,8 @@ static void raid5d(struct md_thread *thread)
|
||||
/* Now is a good time to flush some bitmap updates */
|
||||
conf->seq_flush++;
|
||||
spin_unlock_irq(&conf->device_lock);
|
||||
mddev->bitmap_ops->unplug(mddev, true);
|
||||
if (md_bitmap_enabled(mddev, true))
|
||||
mddev->bitmap_ops->unplug(mddev, true);
|
||||
spin_lock_irq(&conf->device_lock);
|
||||
conf->seq_write = conf->seq_flush;
|
||||
activate_bit_delay(conf, conf->temp_inactive_list);
|
||||
@@ -8309,7 +8312,6 @@ static int raid5_resize(struct mddev *mddev, sector_t sectors)
|
||||
*/
|
||||
sector_t newsize;
|
||||
struct r5conf *conf = mddev->private;
|
||||
int ret;
|
||||
|
||||
if (raid5_has_log(conf) || raid5_has_ppl(conf))
|
||||
return -EINVAL;
|
||||
@@ -8319,9 +8321,12 @@ static int raid5_resize(struct mddev *mddev, sector_t sectors)
|
||||
mddev->array_sectors > newsize)
|
||||
return -EINVAL;
|
||||
|
||||
ret = mddev->bitmap_ops->resize(mddev, sectors, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
if (md_bitmap_enabled(mddev, false)) {
|
||||
int ret = mddev->bitmap_ops->resize(mddev, sectors, 0);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
md_set_array_sectors(mddev, newsize);
|
||||
if (sectors > mddev->dev_sectors &&
|
||||
|
||||
Reference in New Issue
Block a user