[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALTww2-71P6Z0zxOeWJhu3bJ5AkKNqP0K+6M1djmBG=mZg38_w@mail.gmail.com>
Date: Fri, 25 Jul 2025 11:42:47 +0800
From: Xiao Ni <xni@...hat.com>
To: Yu Kuai <yukuai1@...weicloud.com>
Cc: agk@...hat.com, snitzer@...nel.org, mpatocka@...hat.com, song@...nel.org,
yukuai3@...wei.com, dm-devel@...ts.linux.dev, linux-raid@...r.kernel.org,
linux-kernel@...r.kernel.org, yi.zhang@...wei.com, yangerkun@...wei.com,
johnny.chenyi@...wei.com
Subject: Re: [PATCH v5 04/15] md/md-bitmap: merge md_bitmap_group into bitmap_operations
On Mon, Jul 7, 2025 at 9:35 AM Yu Kuai <yukuai1@...weicloud.com> wrote:
>
> From: Yu Kuai <yukuai3@...wei.com>
>
> Now that all bitmap implementations are internal, it doesn't make sense
> to export md_bitmap_group anymore.
>
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
> ---
> drivers/md/md-bitmap.c | 5 ++++-
> drivers/md/md-bitmap.h | 2 ++
> drivers/md/md.c | 6 +++++-
> drivers/md/md.h | 1 -
> 4 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c
> index fc7282304b00..0ba1da35aa84 100644
> --- a/drivers/md/md-bitmap.c
> +++ b/drivers/md/md-bitmap.c
> @@ -2990,7 +2990,8 @@ static struct attribute *md_bitmap_attrs[] = {
> &max_backlog_used.attr,
> NULL
> };
> -const struct attribute_group md_bitmap_group = {
> +
> +static struct attribute_group md_bitmap_group = {
> .name = "bitmap",
> .attrs = md_bitmap_attrs,
> };
> @@ -3026,6 +3027,8 @@ static struct bitmap_operations bitmap_ops = {
> .copy_from_slot = bitmap_copy_from_slot,
> .set_pages = bitmap_set_pages,
> .free = md_bitmap_free,
> +
> + .group = &md_bitmap_group,
> };
>
> void mddev_set_bitmap_ops(struct mddev *mddev)
> diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h
> index 28c1f1c1cc83..0ceb9e97d21f 100644
> --- a/drivers/md/md-bitmap.h
> +++ b/drivers/md/md-bitmap.h
> @@ -100,6 +100,8 @@ struct bitmap_operations {
> sector_t *hi, bool clear_bits);
> void (*set_pages)(void *data, unsigned long pages);
> void (*free)(void *data);
> +
> + struct attribute_group *group;
> };
>
> /* the bitmap API */
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index bda3ef814d97..7ed95e5e43fc 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -5749,7 +5749,6 @@ static const struct attribute_group md_redundancy_group = {
>
> static const struct attribute_group *md_attr_groups[] = {
> &md_default_group,
> - &md_bitmap_group,
> NULL,
> };
>
> @@ -5996,6 +5995,11 @@ struct mddev *md_alloc(dev_t dev, char *name)
> return ERR_PTR(error);
> }
>
> + if (mddev->bitmap_ops && mddev->bitmap_ops->group)
> + if (sysfs_create_group(&mddev->kobj, mddev->bitmap_ops->group))
> + pr_warn("md: cannot register extra bitmap attributes for %s\n",
> + mdname(mddev));
> +
> kobject_uevent(&mddev->kobj, KOBJ_ADD);
> mddev->sysfs_state = sysfs_get_dirent_safe(mddev->kobj.sd, "array_state");
> mddev->sysfs_level = sysfs_get_dirent_safe(mddev->kobj.sd, "level");
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index 67b365621507..d6fba4240f97 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -796,7 +796,6 @@ struct md_sysfs_entry {
> ssize_t (*show)(struct mddev *, char *);
> ssize_t (*store)(struct mddev *, const char *, size_t);
> };
> -extern const struct attribute_group md_bitmap_group;
>
> static inline struct kernfs_node *sysfs_get_dirent_safe(struct kernfs_node *sd, char *name)
> {
> --
> 2.39.2
>
>
Looks good to me.
Reviewed-by: Xiao Ni <xni@...hat.com>
Powered by blists - more mailing lists