Re: [PATCH v2 4/5] md: skip ID_BITMAP_NONE when show available bitmap types
Su Yue <[email protected]>
| Newsgroups | gmane.linux.raid |
|---|---|
| Message-ID | <[email protected]> |
On Mon 13 Apr 2026 at 16:15, Li Nan <[email protected]> wrote: > 在 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? > I dont' think so. There is one case CONFIG_MD_BITMAP is not enabled which means register_md_submodule(&none_bitmap_ops.head) is not called but in mddev_init(): int mddev_init(struct mddev *mddev) | { | int err = 0; | | if (!IS_ENABLED(CONFIG_MD_BITMAP)) | mddev->bitmap_id = ID_BITMAP_NONE; ... } -- Su > > if (mddev->bitmap_id == ID_BITMAP_NONE) > len += sprintf(page + len, "[none] "); > else > len += sprintf(page + len, "none ");