@@ -567,10 +567,7 @@ MODULE_PARM_DESC(num_compress_pages,
567567int f2fs_init_compress_mempool (void )
568568{
569569 compress_page_pool = mempool_create_page_pool (num_compress_pages , 0 );
570- if (!compress_page_pool )
571- return - ENOMEM ;
572-
573- return 0 ;
570+ return compress_page_pool ? 0 : - ENOMEM ;
574571}
575572
576573void f2fs_destroy_compress_mempool (void )
@@ -1983,63 +1980,32 @@ int f2fs_init_page_array_cache(struct f2fs_sb_info *sbi)
19831980
19841981 sbi -> page_array_slab = f2fs_kmem_cache_create (slab_name ,
19851982 sbi -> page_array_slab_size );
1986- if (!sbi -> page_array_slab )
1987- return - ENOMEM ;
1988- return 0 ;
1983+ return sbi -> page_array_slab ? 0 : - ENOMEM ;
19891984}
19901985
19911986void f2fs_destroy_page_array_cache (struct f2fs_sb_info * sbi )
19921987{
19931988 kmem_cache_destroy (sbi -> page_array_slab );
19941989}
19951990
1996- static int __init f2fs_init_cic_cache (void )
1991+ int __init f2fs_init_compress_cache (void )
19971992{
19981993 cic_entry_slab = f2fs_kmem_cache_create ("f2fs_cic_entry" ,
19991994 sizeof (struct compress_io_ctx ));
20001995 if (!cic_entry_slab )
20011996 return - ENOMEM ;
2002- return 0 ;
2003- }
2004-
2005- static void f2fs_destroy_cic_cache (void )
2006- {
2007- kmem_cache_destroy (cic_entry_slab );
2008- }
2009-
2010- static int __init f2fs_init_dic_cache (void )
2011- {
20121997 dic_entry_slab = f2fs_kmem_cache_create ("f2fs_dic_entry" ,
20131998 sizeof (struct decompress_io_ctx ));
20141999 if (!dic_entry_slab )
2015- return - ENOMEM ;
2016- return 0 ;
2017- }
2018-
2019- static void f2fs_destroy_dic_cache (void )
2020- {
2021- kmem_cache_destroy (dic_entry_slab );
2022- }
2023-
2024- int __init f2fs_init_compress_cache (void )
2025- {
2026- int err ;
2027-
2028- err = f2fs_init_cic_cache ();
2029- if (err )
2030- goto out ;
2031- err = f2fs_init_dic_cache ();
2032- if (err )
20332000 goto free_cic ;
20342001 return 0 ;
20352002free_cic :
2036- f2fs_destroy_cic_cache ();
2037- out :
2003+ kmem_cache_destroy (cic_entry_slab );
20382004 return - ENOMEM ;
20392005}
20402006
20412007void f2fs_destroy_compress_cache (void )
20422008{
2043- f2fs_destroy_dic_cache ( );
2044- f2fs_destroy_cic_cache ( );
2009+ kmem_cache_destroy ( dic_entry_slab );
2010+ kmem_cache_destroy ( cic_entry_slab );
20452011}
0 commit comments