Re: [PATCH v2 4/5] md: skip ID_BITMAP_NONE when show available bitmap types

Li Nan <[email protected]>
Newsgroups gmane.linux.raid
Message-ID <[email protected]>

在 2026/4/7 18:26, Su Yue 写道:
> As none_bitmap_ops is introduced, ID_BITMAP_NONE should be skipped while
> iterating md submodules, otherwise:
> 
> $ cat /sys/block/md0/md/bitmap_type
> [none] bitmap llbitmap [none]
> 
> Signed-off-by: Su Yue <[email protected]>
> ---
>   drivers/md/md.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 55a95b227b83..20a953676319 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -4269,6 +4269,8 @@ bitmap_type_show(struct mddev *mddev, char *page)
>   	xa_for_each(&md_submodule, i, head) {
>   		if (head->type != MD_BITMAP)
>   			continue;
> +		if (head->id == ID_BITMAP_NONE)
> +			continue;
>   
>   		if (mddev->bitmap_id == head->id)
>   			len += sprintf(page + len, "[%s] ", head->name);

If we indeed add ID_BITMAP_NONE as patch 3, would it be better to delete
this piece of code instead?

         if (mddev->bitmap_id == ID_BITMAP_NONE)
                 len += sprintf(page + len, "[none] ");
         else
                 len += sprintf(page + len, "none ");

-- 
Thanks,
Nan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.