From: Mateusz Guzik Date: Mon, 1 Dec 2025 08:32:26 +0000 (+0100) Subject: fs: hide names_cache behind runtime const machinery X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ca83f8ebe86706c4164ac21871f4a5adb86a430;p=thirdparty%2Fkernel%2Flinux.git fs: hide names_cache behind runtime const machinery s/names_cachep/names_cache/ for consistency with dentry cache. Signed-off-by: Mateusz Guzik Signed-off-by: Al Viro --- diff --git a/fs/namei.c b/fs/namei.c index 57043b81fe274..06d60808b0ff5 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -41,6 +41,8 @@ #include #include +#include + #include "internal.h" #include "mount.h" @@ -124,23 +126,25 @@ */ /* SLAB cache for struct filename instances */ -static struct kmem_cache *names_cachep __ro_after_init; +static struct kmem_cache *__names_cache __ro_after_init; +#define names_cache runtime_const_ptr(__names_cache) void __init filename_init(void) { - names_cachep = kmem_cache_create_usercopy("names_cache", sizeof(struct filename), 0, - SLAB_HWCACHE_ALIGN|SLAB_PANIC, offsetof(struct filename, iname), - EMBEDDED_NAME_MAX, NULL); + __names_cache = kmem_cache_create_usercopy("names_cache", sizeof(struct filename), 0, + SLAB_HWCACHE_ALIGN|SLAB_PANIC, offsetof(struct filename, iname), + EMBEDDED_NAME_MAX, NULL); + runtime_const_init(ptr, __names_cache); } static inline struct filename *alloc_filename(void) { - return kmem_cache_alloc(names_cachep, GFP_KERNEL); + return kmem_cache_alloc(names_cache, GFP_KERNEL); } static inline void free_filename(struct filename *p) { - kmem_cache_free(names_cachep, p); + kmem_cache_free(names_cache, p); } static inline void initname(struct filename *name) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 8ca130af301fc..eeb070f330bdb 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -972,7 +972,8 @@ #define RUNTIME_CONST_VARIABLES \ RUNTIME_CONST(shift, d_hash_shift) \ RUNTIME_CONST(ptr, dentry_hashtable) \ - RUNTIME_CONST(ptr, __dentry_cache) + RUNTIME_CONST(ptr, __dentry_cache) \ + RUNTIME_CONST(ptr, __names_cache) /* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */ #define KUNIT_TABLE() \