]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs: hide names_cache behind runtime const machinery
authorMateusz Guzik <mjguzik@gmail.com>
Mon, 1 Dec 2025 08:32:26 +0000 (09:32 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 13 Jan 2026 20:17:26 +0000 (15:17 -0500)
s/names_cachep/names_cache/ for consistency with dentry cache.

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c
include/asm-generic/vmlinux.lds.h

index 57043b81fe274cb0c4e840b12b2f45ff4ab5f4f3..06d60808b0ff5afcdbb40fba8eed2f0b5cc48fc6 100644 (file)
@@ -41,6 +41,8 @@
 #include <linux/init_task.h>
 #include <linux/uaccess.h>
 
+#include <asm/runtime-const.h>
+
 #include "internal.h"
 #include "mount.h"
 
  */
 
 /* 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)
index 8ca130af301fc54fdbd749c1e442de16c960e65d..eeb070f330bdb8ef301fadfe57ebefe1b0a01755 100644 (file)
 #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()                                                  \