diff mbox series

md/md-bitmap: fix stats collection for external bitmaps

Message ID 20250402011523.2271768-1-zhengqixing@huaweicloud.com (mailing list archive)
State New
Headers show
Series md/md-bitmap: fix stats collection for external bitmaps | expand

Checks

Context Check Description
mdraidci/vmtest-md-6_14-PR success PR summary
mdraidci/vmtest-md-6_14-VM_Test-0 success Logs for per-patch-testing

Commit Message

Zheng Qixing April 2, 2025, 1:15 a.m. UTC
From: Zheng Qixing <zhengqixing@huawei.com>

The bitmap_get_stats() function incorrectly returns -ENOENT for external
bitmaps, preventing statistics collection when a valid superblock page
exists.

Remove the external bitmap check as the statistics should be available
regardless of bitmap storage location when sb_page is present.

Note: "bitmap_info.external" here refers to a bitmap stored in a separate
file (bitmap_file), not to external metadata.

Fixes: 8d28d0ddb986 ("md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime")
Signed-off-by: Zheng Qixing <zhengqixing@huawei.com>
---
 drivers/md/md-bitmap.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Yu Kuai April 3, 2025, 1:53 a.m. UTC | #1
Hi,

在 2025/04/02 9:15, Zheng Qixing 写道:
> From: Zheng Qixing <zhengqixing@huawei.com>
> 
> The bitmap_get_stats() function incorrectly returns -ENOENT for external
> bitmaps, preventing statistics collection when a valid superblock page
> exists.
> 
> Remove the external bitmap check as the statistics should be available
> regardless of bitmap storage location when sb_page is present.
> 
> Note: "bitmap_info.external" here refers to a bitmap stored in a separate
> file (bitmap_file), not to external metadata.
> 
> Fixes: 8d28d0ddb986 ("md/md-bitmap: Synchronize bitmap_get_stats() with bitmap lifetime")
> Signed-off-by: Zheng Qixing <zhengqixing@huawei.com>
> ---
>   drivers/md/md-bitmap.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index 44ec9b17cfd3..afd01c93ddd9 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -2357,8 +2357,6 @@ static int bitmap_get_stats(void *data, struct md_bitmap_stats *stats)
>   
>   	if (!bitmap)
>   		return -ENOENT;
> -	if (bitmap->mddev->bitmap_info.external)
> -		return -ENOENT;
>   	if (!bitmap->storage.sb_page) /* no superblock */
>   		return -EINVAL;

bitmap_file doesn't have sb, so above condition still need to be fixed.

Thanks,
Kuai

>   	sb = kmap_local_page(bitmap->storage.sb_page);
>
diff mbox series

Patch

diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
index 44ec9b17cfd3..afd01c93ddd9 100644
--- a/drivers/md/md-bitmap.c
+++ b/drivers/md/md-bitmap.c
@@ -2357,8 +2357,6 @@  static int bitmap_get_stats(void *data, struct md_bitmap_stats *stats)
 
 	if (!bitmap)
 		return -ENOENT;
-	if (bitmap->mddev->bitmap_info.external)
-		return -ENOENT;
 	if (!bitmap->storage.sb_page) /* no superblock */
 		return -EINVAL;
 	sb = kmap_local_page(bitmap->storage.sb_page);