From: Max Kellermann <max@blarg.de>
To: Viacheslav Dubeyko <slava@dubeyko.com>
Cc: ceph-devel@vger.kernel.org, idryomov@gmail.com,
linux-fsdevel@vger.kernel.org, pdonnell@redhat.com,
amarkuze@redhat.com, Slava.Dubeyko@ibm.com, vdubeyko@redhat.com
Subject: Re: [RFC PATCH 18/20] ceph: add comments to metadata structures in string_table.h
Date: Sat, 6 Sep 2025 00:00:42 +0200 [thread overview]
Message-ID: <aLtdivQ9_BuZF3wM@swift.blarg.de> (raw)
In-Reply-To: <20250905200108.151563-19-slava@dubeyko.com>
On 2025/09/05 22:01, Viacheslav Dubeyko <slava@dubeyko.com> wrote:
> +/*
> + * Reference-counted string metadata: Interned string with automatic memory
> + * management and deduplication. Uses red-black tree for efficient lookup and
> + * RCU for safe concurrent access. Strings are immutable and shared across
> + * multiple users to reduce memory usage.
> + */
No, it doesn't use rbtree AND rcu. It uses rbtree OR rcu - it's a
union, it cannot use both. But when does it use one or the other?
That would have been helpful to know.
> struct ceph_string {
> + /* Reference counting for automatic cleanup */
> struct kref kref;
In the other patch, you wrote that reference counting is "for safe
shared access", and now it's "for automatic cleanup". But it's really
neither. Reference counters do not do automatic cleanup. They are a
tool to be able to detect when the last reference is dropped. And
then you can do the cleanup. But that is not automatic. You have to
implement it manually for eac use of struct kref.
This comment is confusing and adds no value.
> union {
> + /* Red-black tree node for string table lookup */
> struct rb_node node;
> + /* RCU head for safe deferred cleanup */
> struct rcu_head rcu;
These two comments add no value, they don't explain anything that
isn't already obvious from looking at the struct types. Explaining
that "rb_node" is a "Red-black tree node" is just noise that doesn't
belong here; if anything, it belongs to the rbtree_node documentation.
Repeating such text everywhere has a negative impact on people's time.
> };
> + /* Length of the string in bytes */
> size_t len;
> + /* Variable-length string data (NUL-terminated) */
> char str[];
The "[]" and the "NUL-terminated" and the "len" field already imply
that it's variable-length. Writing this again is just noise.
next prev parent reply other threads:[~2025-09-05 22:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 20:00 [RFC PATCH 00/20] add comments in include/linux/ceph/*.h Viacheslav Dubeyko
2025-09-05 20:00 ` [RFC PATCH 01/20] ceph: add comments to metadata structures in auth.h Viacheslav Dubeyko
2025-09-05 21:50 ` Max Kellermann
2025-09-05 20:00 ` [RFC PATCH 02/20] ceph: add comments to metadata structures in buffer.h Viacheslav Dubeyko
2025-09-05 21:43 ` Max Kellermann
2025-09-05 20:00 ` [RFC PATCH 03/20] ceph: add comments in ceph_debug.h Viacheslav Dubeyko
2025-09-05 20:00 ` [RFC PATCH 04/20] ceph: add comments to declarations in ceph_features.h Viacheslav Dubeyko
2025-09-05 20:00 ` [RFC PATCH 05/20] ceph: rework comments in ceph_frag.h Viacheslav Dubeyko
2025-09-05 20:00 ` [RFC PATCH 06/20] ceph: add comments to metadata structures in ceph_fs.h Viacheslav Dubeyko
2025-09-05 20:00 ` [RFC PATCH 07/20] ceph: add comments in ceph_hash.h Viacheslav Dubeyko
2025-09-05 20:00 ` [RFC PATCH 08/20] ceph: add comments to metadata structures in cls_lock_client.h Viacheslav Dubeyko
2025-09-05 20:00 ` [RFC PATCH 09/20] ceph: add comments to metadata structures in libceph.h Viacheslav Dubeyko
2025-09-05 20:00 ` [RFC PATCH 10/20] ceph: add comments to metadata structures in messenger.h Viacheslav Dubeyko
2025-09-05 20:00 ` [RFC PATCH 11/20] ceph: add comments to metadata structures in mon_client.h Viacheslav Dubeyko
2025-09-05 20:01 ` [RFC PATCH 12/20] ceph: add comments to metadata structures in msgpool.h Viacheslav Dubeyko
2025-09-05 20:01 ` [RFC PATCH 13/20] ceph: add comments to metadata structures in msgr.h Viacheslav Dubeyko
2025-09-05 22:18 ` Max Kellermann
2025-09-05 20:01 ` [RFC PATCH 14/20] ceph: add comments to metadata structures in osd_client.h Viacheslav Dubeyko
2025-09-05 20:01 ` [RFC PATCH 15/20] ceph: add comments to metadata structures in osdmap.h Viacheslav Dubeyko
2025-09-05 20:01 ` [RFC PATCH 16/20] ceph: add comments to metadata structures in pagelist.h Viacheslav Dubeyko
2025-09-05 20:01 ` [RFC PATCH 17/20] ceph: add comments to metadata structures in rados.h Viacheslav Dubeyko
2025-09-05 20:01 ` [RFC PATCH 18/20] ceph: add comments to metadata structures in string_table.h Viacheslav Dubeyko
2025-09-05 22:00 ` Max Kellermann [this message]
2025-09-05 20:01 ` [RFC PATCH 19/20] ceph: add comments to metadata structures in striper.h Viacheslav Dubeyko
2025-09-05 20:01 ` [RFC PATCH 20/20] ceph: add comments to metadata structures in types.h Viacheslav Dubeyko
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=aLtdivQ9_BuZF3wM@swift.blarg.de \
--to=max@blarg.de \
--cc=Slava.Dubeyko@ibm.com \
--cc=amarkuze@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=pdonnell@redhat.com \
--cc=slava@dubeyko.com \
--cc=vdubeyko@redhat.com \
/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).