Skip to content

Commit 5f7d256

Browse files
braunertehcaster
authored andcommitted
file: port to struct kmem_cache_args
Port filp_cache to struct kmem_cache_args. Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Reviewed-by: Mike Rapoport (Microsoft) <[email protected]> Reviewed-by: Vlastimil Babka <[email protected]> Signed-off-by: Christian Brauner <[email protected]> Reviewed-by: Roman Gushchin <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent b2e7456 commit 5f7d256

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

fs/file_table.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,14 @@ EXPORT_SYMBOL(__fput_sync);
511511

512512
void __init files_init(void)
513513
{
514-
filp_cachep = kmem_cache_create_rcu("filp", sizeof(struct file),
515-
offsetof(struct file, f_freeptr),
516-
SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);
514+
struct kmem_cache_args args = {
515+
.use_freeptr_offset = true,
516+
.freeptr_offset = offsetof(struct file, f_freeptr),
517+
};
518+
519+
filp_cachep = kmem_cache_create("filp", sizeof(struct file), &args,
520+
SLAB_HWCACHE_ALIGN | SLAB_PANIC |
521+
SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU);
517522
percpu_counter_init(&nr_files, 0, GFP_KERNEL);
518523
}
519524

0 commit comments

Comments
 (0)