diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-02-16 14:31:58 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-02-23 13:06:38 +0100 |
| commit | b32c4a213698ab351b44da2fd1b2a5976c7fa033 (patch) | |
| tree | fa3baa49acd5e1c871269173b68826375dedb855 /mm/shmem.c | |
| parent | 94d709be8c0dc875dfc9ebb64d3b8093d0790c15 (diff) | |
| download | linux-next-b32c4a213698ab351b44da2fd1b2a5976c7fa033.tar.gz linux-next-b32c4a213698ab351b44da2fd1b2a5976c7fa033.zip | |
xattr: add rhashtable-based simple_xattr infrastructure
Add rhashtable support to the simple_xattr subsystem while keeping the
existing rbtree code fully functional. This allows consumers to be
migrated one at a time without breaking any intermediate build.
struct simple_xattrs gains a dispatch flag and a union holding either
the rbtree (rb_root + rwlock) or rhashtable state:
struct simple_xattrs {
bool use_rhashtable;
union {
struct { struct rb_root rb_root; rwlock_t lock; };
struct rhashtable ht;
};
};
simple_xattrs_init() continues to set up the rbtree path for existing
embedded-struct callers.
Add simple_xattrs_alloc() which dynamically allocates a simple_xattrs
and initializes the rhashtable path. This is the entry point for
consumers switching to pointer-based lazy allocation.
The five core functions (get, set, list, add, free) dispatch based on
the use_rhashtable flag.
Existing callers continue to use the rbtree path unchanged. As each
consumer is converted it will switch to simple_xattrs_alloc() and the
rhashtable path. Once all consumers are converted a follow-up patch
will remove the rbtree code.
Link: https://patch.msgid.link/20260216-work-xattr-socket-v1-2-c2efa4f74cb7@kernel.org
Acked-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'mm/shmem.c')
| -rw-r--r-- | mm/shmem.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index b40f3cd48961..35c2f8748668 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4278,7 +4278,7 @@ static int shmem_initxattrs(struct inode *inode, for (xattr = xattr_array; xattr->name != NULL; xattr++) { new_xattr = simple_xattr_alloc(xattr->value, xattr->value_len); - if (!new_xattr) + if (IS_ERR(new_xattr)) break; len = strlen(xattr->name) + 1; |
