mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
md/dm-raid: check before referencing mddev->bitmap_ops
Prepare to introduce CONFIG_MD_BITMAP. Link: https://lore.kernel.org/linux-raid/20250707012711.376844-14-yukuai1@huaweicloud.com Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Xiao Ni <xni@redhat.com>
This commit is contained in:
@@ -3953,9 +3953,11 @@ static int __load_dirty_region_bitmap(struct raid_set *rs)
|
||||
!test_and_set_bit(RT_FLAG_RS_BITMAP_LOADED, &rs->runtime_flags)) {
|
||||
struct mddev *mddev = &rs->md;
|
||||
|
||||
r = mddev->bitmap_ops->load(mddev);
|
||||
if (r)
|
||||
DMERR("Failed to load bitmap");
|
||||
if (md_bitmap_enabled(mddev, false)) {
|
||||
r = mddev->bitmap_ops->load(mddev);
|
||||
if (r)
|
||||
DMERR("Failed to load bitmap");
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
@@ -4070,10 +4072,12 @@ static int raid_preresume(struct dm_target *ti)
|
||||
mddev->bitmap_info.chunksize != to_bytes(rs->requested_bitmap_chunk_sectors)))) {
|
||||
int chunksize = to_bytes(rs->requested_bitmap_chunk_sectors) ?: mddev->bitmap_info.chunksize;
|
||||
|
||||
r = mddev->bitmap_ops->resize(mddev, mddev->dev_sectors,
|
||||
chunksize);
|
||||
if (r)
|
||||
DMERR("Failed to resize bitmap");
|
||||
if (md_bitmap_enabled(mddev, false)) {
|
||||
r = mddev->bitmap_ops->resize(mddev, mddev->dev_sectors,
|
||||
chunksize);
|
||||
if (r)
|
||||
DMERR("Failed to resize bitmap");
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for any resize/reshape on @rs and adjust/initiate */
|
||||
|
||||
Reference in New Issue
Block a user