From: 余快 <yukuai1994@gmail.com>
To: Hannes Reinecke <hare@suse.de>
Cc: Yu Kuai <yukuai@kernel.org>,
hch@lst.de, xni@redhat.com, axboe@kernel.dk,
linux-raid@vger.kernel.org, song@kernel.org, yukuai3@huawei.com,
yangerkun@huawei.com, yi.zhang@huawei.com,
johnny.chenyi@huawei.com
Subject: Re: [PATCH v2 06/11] md/md-bitmap: delay registration of bitmap_ops until creating bitmap
Date: Wed, 9 Jul 2025 14:44:05 +0800 [thread overview]
Message-ID: <CAHW3DrhO0gikFu4Hv6fTAp-xL8jZs5VVikw==w7Msjj7x376ug@mail.gmail.com> (raw)
In-Reply-To: <9cc88458-5162-42e0-97ab-07ef0c529061@suse.de>
Hi,
在 2025/7/8 19:57, Hannes Reinecke 写道:
> On 7/8/25 13:31, 余快 wrote:
>> Hi,
>>
>> Hannes Reinecke <hare@suse.de <mailto:hare@suse.de>> 于2025年7月8日周二
>> 14:29写道:
>>
>> > + if (mddev->bitmap_ops->group && !mddev_is_dm(mddev)) {
>> > + if (sysfs_create_group(&mddev->kobj, mddev-
>> >bitmap_ops->group))
>> > + pr_warn("md: cannot register extra bitmap
>> attributes for %s\n",
>> > + mdname(mddev));
>> > + else
>> > + kobject_uevent(&mddev->kobj, KOBJ_CHANGE);
>> > + }
>> > return true;
>> >
>> > err:
>>
>> Ouch. This will cause havoc with the udev rules.
>> Having different events for 'add' and 'change' tends to confuse udev
>> rules (most treat 'add' and 'change' identically), so at the very
>> least
>> you would need to document this.
>>
>>
>> Do you mean document here as new sysfs entries are created under mddev
>> kobject?
>>
> No, I meant to document that 'add' events will have access to
> different sysfs attributes than the 'change' events.
> In the running system one will only see the final status, so it's not
> immediately obvious that some attributes are only valid for 'change',
> and not for 'add'.
Thanks for the explanation, just to make sure you mean:
diff --git a/Documentation/admin-guide/md.rst
b/Documentation/admin-guide/md.rst
index 2030772075b5..db7a39894c8d 100644
--- a/Documentation/admin-guide/md.rst
+++ b/Documentation/admin-guide/md.rst
@@ -388,6 +388,9 @@ All md devices contain:
bitmap
The default internal bitmap
+If bitmap_type is not none, then additional bitmap attributes will be
created
+after md device KOBJ_CHANGE event.
+
If bitmap_type is bitmap, then the md device will also contain:
bitmap/location
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 22378686a964..60e2de23c9b5 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -699,6 +699,7 @@ static bool mddev_set_bitmap_ops(struct mddev *mddev)
pr_warn("md: cannot register extra bitmap
attributes for %s\n",
mdname(mddev));
else
+ /* Inform user with KOBJ_CHANGE about new bitmap
attributes. */
kobject_uevent(&mddev->kobj, KOBJ_CHANGE);
}
return true;
>
> Cheers,
>
> Hannes
next prev parent reply other threads:[~2025-07-09 6:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 16:51 [PATCH v2 00/11] md/llbitmap: md/md-llbitmap: introduce a new lockless bitmap Yu Kuai
2025-07-07 16:51 ` [PATCH v2 01/11] md: add a new parameter 'offset' to md_super_write() Yu Kuai
2025-07-07 16:51 ` [PATCH v2 02/11] md: factor out a helper raid_is_456() Yu Kuai
2025-07-07 16:51 ` [PATCH v2 03/11] md/md-bitmap: support discard for bitmap ops Yu Kuai
2025-07-08 6:21 ` Hannes Reinecke
2025-07-07 16:51 ` [PATCH v2 04/11] md: add a new mddev field 'bitmap_id' Yu Kuai
2025-07-08 6:23 ` Hannes Reinecke
2025-07-07 16:51 ` [PATCH v2 05/11] md/md-bitmap: add a new sysfs api bitmap_type Yu Kuai
2025-07-08 6:24 ` Hannes Reinecke
2025-07-07 16:51 ` [PATCH v2 06/11] md/md-bitmap: delay registration of bitmap_ops until creating bitmap Yu Kuai
2025-07-08 6:29 ` Hannes Reinecke
[not found] ` <CAHW3DrjVM-yb-U==ZfR3k9ZS7qSpqY4ASch7qqhP2zquTdSS2w@mail.gmail.com>
2025-07-08 11:57 ` Hannes Reinecke
2025-07-09 6:44 ` 余快 [this message]
2025-07-09 9:11 ` Hannes Reinecke
2025-07-07 16:51 ` [PATCH v2 07/11] md/md-bitmap: add a new method skip_sync_blocks() in bitmap_operations Yu Kuai
2025-07-07 16:51 ` [PATCH v2 08/11] md/md-bitmap: add a new method blocks_synced() " Yu Kuai
2025-07-07 16:52 ` [PATCH v2 09/11] md: add a new recovery_flag MD_RECOVERY_LAZY_RECOVER Yu Kuai
2025-07-08 6:29 ` Hannes Reinecke
2025-07-07 16:52 ` [PATCH v2 10/11] md/md-bitmap: make method bitmap_ops->daemon_work optional Yu Kuai
2025-07-07 16:52 ` [PATCH v2 11/11] md/md-llbitmap: introduce new lockless bitmap Yu Kuai
2025-07-08 7:47 ` Hannes Reinecke
2025-07-14 1:41 ` Yu Kuai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHW3DrhO0gikFu4Hv6fTAp-xL8jZs5VVikw==w7Msjj7x376ug@mail.gmail.com' \
--to=yukuai1994@gmail.com \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=johnny.chenyi@huawei.com \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=xni@redhat.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
--cc=yukuai@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).