Skip to content

Commit eeeba7f

Browse files
Zheng Qixinggregkh
authored andcommitted
md/md-bitmap: fix stats collection for external bitmaps
[ Upstream commit 6ec1f02 ] The bitmap_get_stats() function incorrectly returns -ENOENT for external bitmaps. Remove the external bitmap check as the statistics should be available regardless of bitmap storage location. Return -EINVAL only for invalid bitmap with no storage (neither in superblock nor in external file). Note: "bitmap_info.external" here refers to a bitmap stored in a separate file (bitmap_file), not to external metadata. Fixes: 8d28d0d ("md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime") Signed-off-by: Zheng Qixing <zhengqixing@huawei.com> Link: https://lore.kernel.org/linux-raid/20250403015322.2873369-1-zhengqixing@huaweicloud.com Signed-off-by: Yu Kuai <yukuai3@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 54e1060 commit eeeba7f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/md/md-bitmap.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,9 +2355,8 @@ static int bitmap_get_stats(void *data, struct md_bitmap_stats *stats)
23552355

23562356
if (!bitmap)
23572357
return -ENOENT;
2358-
if (bitmap->mddev->bitmap_info.external)
2359-
return -ENOENT;
2360-
if (!bitmap->storage.sb_page) /* no superblock */
2358+
if (!bitmap->mddev->bitmap_info.external &&
2359+
!bitmap->storage.sb_page)
23612360
return -EINVAL;
23622361
sb = kmap_local_page(bitmap->storage.sb_page);
23632362
stats->sync_size = le64_to_cpu(sb->sync_size);

0 commit comments

Comments
 (0)