mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
md/md-bitmap: fix stats collection for external bitmaps
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: 8d28d0ddb9
("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>
This commit is contained in:
parent
d05af90d62
commit
6ec1f02394
1 changed files with 2 additions and 3 deletions
|
@ -2357,9 +2357,8 @@ static int bitmap_get_stats(void *data, struct md_bitmap_stats *stats)
|
||||||
|
|
||||||
if (!bitmap)
|
if (!bitmap)
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
if (bitmap->mddev->bitmap_info.external)
|
if (!bitmap->mddev->bitmap_info.external &&
|
||||||
return -ENOENT;
|
!bitmap->storage.sb_page)
|
||||||
if (!bitmap->storage.sb_page) /* no superblock */
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
sb = kmap_local_page(bitmap->storage.sb_page);
|
sb = kmap_local_page(bitmap->storage.sb_page);
|
||||||
stats->sync_size = le64_to_cpu(sb->sync_size);
|
stats->sync_size = le64_to_cpu(sb->sync_size);
|
||||||
|
|
Loading…
Add table
Reference in a new issue