Commit 060f7739 authored by JunChao Sun's avatar JunChao Sun Committed by Theodore Ts'o

ext4: replace kmem_cache_create with KMEM_CACHE

Replace kmem_cache_create with KMEM_CACHE macro that
guaranteed struct alignment
Signed-off-by: default avatarJunChao Sun <sunjunchao2870@gmail.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20221109153822.80250-1-sunjunchao2870@gmail.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 89481b5f
...@@ -155,9 +155,7 @@ static void __revise_pending(struct inode *inode, ext4_lblk_t lblk, ...@@ -155,9 +155,7 @@ static void __revise_pending(struct inode *inode, ext4_lblk_t lblk,
int __init ext4_init_es(void) int __init ext4_init_es(void)
{ {
ext4_es_cachep = kmem_cache_create("ext4_extent_status", ext4_es_cachep = KMEM_CACHE(extent_status, SLAB_RECLAIM_ACCOUNT);
sizeof(struct extent_status),
0, (SLAB_RECLAIM_ACCOUNT), NULL);
if (ext4_es_cachep == NULL) if (ext4_es_cachep == NULL)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
...@@ -1807,9 +1805,7 @@ static void ext4_print_pending_tree(struct inode *inode) ...@@ -1807,9 +1805,7 @@ static void ext4_print_pending_tree(struct inode *inode)
int __init ext4_init_pending(void) int __init ext4_init_pending(void)
{ {
ext4_pending_cachep = kmem_cache_create("ext4_pending_reservation", ext4_pending_cachep = KMEM_CACHE(pending_reservation, SLAB_RECLAIM_ACCOUNT);
sizeof(struct pending_reservation),
0, (SLAB_RECLAIM_ACCOUNT), NULL);
if (ext4_pending_cachep == NULL) if (ext4_pending_cachep == NULL)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
......
...@@ -410,9 +410,8 @@ int ext4_mpage_readpages(struct inode *inode, ...@@ -410,9 +410,8 @@ int ext4_mpage_readpages(struct inode *inode,
int __init ext4_init_post_read_processing(void) int __init ext4_init_post_read_processing(void)
{ {
bio_post_read_ctx_cache = bio_post_read_ctx_cache = KMEM_CACHE(bio_post_read_ctx, SLAB_RECLAIM_ACCOUNT);
kmem_cache_create("ext4_bio_post_read_ctx",
sizeof(struct bio_post_read_ctx), 0, 0, NULL);
if (!bio_post_read_ctx_cache) if (!bio_post_read_ctx_cache)
goto fail; goto fail;
bio_post_read_ctx_pool = bio_post_read_ctx_pool =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment