]> git.karo-electronics.de Git - linux-beck.git/commitdiff
btrfs: drop null testing before destroy functions
authorKinglong Mee <kinglongmee@gmail.com>
Fri, 29 Jan 2016 13:36:35 +0000 (21:36 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 18 Feb 2016 10:46:03 +0000 (11:46 +0100)
Cleanup.

kmem_cache_destroy has support NULL argument checking,
so drop the double null testing before calling it.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/backref.c
fs/btrfs/delayed-inode.c
fs/btrfs/delayed-ref.c
fs/btrfs/disk-io.c
fs/btrfs/extent_io.c
fs/btrfs/extent_map.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ordered-data.c

index dc6e9a32d019c157cdf88a4d38d4c33bec87e4f5..447d0ac736db5debe0da5f3059df67addbaad93f 100644 (file)
@@ -148,8 +148,7 @@ int __init btrfs_prelim_ref_init(void)
 
 void btrfs_prelim_ref_exit(void)
 {
-       if (btrfs_prelim_ref_cache)
-               kmem_cache_destroy(btrfs_prelim_ref_cache);
+       kmem_cache_destroy(btrfs_prelim_ref_cache);
 }
 
 /*
index 0be47e4b813672996b490515ef88af357c40a276..716a4ec7733273b5650a043161659314e4434c4c 100644 (file)
@@ -43,8 +43,7 @@ int __init btrfs_delayed_inode_init(void)
 
 void btrfs_delayed_inode_exit(void)
 {
-       if (delayed_node_cache)
-               kmem_cache_destroy(delayed_node_cache);
+       kmem_cache_destroy(delayed_node_cache);
 }
 
 static inline void btrfs_init_delayed_node(
index 914ac13bd92f2e34fd973d2e6da02708a7daa5d8..430b3689b112b745d531109f64f1dc3ac10bca78 100644 (file)
@@ -929,14 +929,10 @@ btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr)
 
 void btrfs_delayed_ref_exit(void)
 {
-       if (btrfs_delayed_ref_head_cachep)
-               kmem_cache_destroy(btrfs_delayed_ref_head_cachep);
-       if (btrfs_delayed_tree_ref_cachep)
-               kmem_cache_destroy(btrfs_delayed_tree_ref_cachep);
-       if (btrfs_delayed_data_ref_cachep)
-               kmem_cache_destroy(btrfs_delayed_data_ref_cachep);
-       if (btrfs_delayed_extent_op_cachep)
-               kmem_cache_destroy(btrfs_delayed_extent_op_cachep);
+       kmem_cache_destroy(btrfs_delayed_ref_head_cachep);
+       kmem_cache_destroy(btrfs_delayed_tree_ref_cachep);
+       kmem_cache_destroy(btrfs_delayed_data_ref_cachep);
+       kmem_cache_destroy(btrfs_delayed_extent_op_cachep);
 }
 
 int btrfs_delayed_ref_init(void)
index 4545e2e2ad45a556113eecf30b1a7d49ee7ca260..19f8e5bd7dfb18da602d918aef6d7f852a7218c0 100644 (file)
@@ -110,8 +110,7 @@ int __init btrfs_end_io_wq_init(void)
 
 void btrfs_end_io_wq_exit(void)
 {
-       if (btrfs_end_io_wq_cache)
-               kmem_cache_destroy(btrfs_end_io_wq_cache);
+       kmem_cache_destroy(btrfs_end_io_wq_cache);
 }
 
 /*
index f3910ac00d895c998fd8da1cae9d7f2e8eb80a14..96d24d04979768269ae8e7eb1e557993a9368830 100644 (file)
@@ -206,10 +206,8 @@ void extent_io_exit(void)
         * destroy caches.
         */
        rcu_barrier();
-       if (extent_state_cache)
-               kmem_cache_destroy(extent_state_cache);
-       if (extent_buffer_cache)
-               kmem_cache_destroy(extent_buffer_cache);
+       kmem_cache_destroy(extent_state_cache);
+       kmem_cache_destroy(extent_buffer_cache);
        if (btrfs_bioset)
                bioset_free(btrfs_bioset);
 }
index 84fb56d5c018dbfea2a4b1970e4275ada5daa0fb..cdbadeaef2028351cbca7990234d71a1d4334c63 100644 (file)
@@ -20,8 +20,7 @@ int __init extent_map_init(void)
 
 void extent_map_exit(void)
 {
-       if (extent_map_cache)
-               kmem_cache_destroy(extent_map_cache);
+       kmem_cache_destroy(extent_map_cache);
 }
 
 /**
index 610f56992464892a085b21891c7c2cee4ec5f4f1..b387fb53a880e06258f8b5fea955e5fa52c59fff 100644 (file)
@@ -2939,8 +2939,7 @@ const struct file_operations btrfs_file_operations = {
 
 void btrfs_auto_defrag_exit(void)
 {
-       if (btrfs_inode_defrag_cachep)
-               kmem_cache_destroy(btrfs_inode_defrag_cachep);
+       kmem_cache_destroy(btrfs_inode_defrag_cachep);
 }
 
 int btrfs_auto_defrag_init(void)
index cf0b3795364aab33ea0439263d5099fd081cc1eb..f067c77425bd92ea3b07d2ab1d97ed3e1b9752aa 100644 (file)
@@ -9178,16 +9178,11 @@ void btrfs_destroy_cachep(void)
         * destroy cache.
         */
        rcu_barrier();
-       if (btrfs_inode_cachep)
-               kmem_cache_destroy(btrfs_inode_cachep);
-       if (btrfs_trans_handle_cachep)
-               kmem_cache_destroy(btrfs_trans_handle_cachep);
-       if (btrfs_transaction_cachep)
-               kmem_cache_destroy(btrfs_transaction_cachep);
-       if (btrfs_path_cachep)
-               kmem_cache_destroy(btrfs_path_cachep);
-       if (btrfs_free_space_cachep)
-               kmem_cache_destroy(btrfs_free_space_cachep);
+       kmem_cache_destroy(btrfs_inode_cachep);
+       kmem_cache_destroy(btrfs_trans_handle_cachep);
+       kmem_cache_destroy(btrfs_transaction_cachep);
+       kmem_cache_destroy(btrfs_path_cachep);
+       kmem_cache_destroy(btrfs_free_space_cachep);
 }
 
 int btrfs_init_cachep(void)
index 8c27292ea9ea09361d94389c5a7f7a146bb8a925..988eb1513aa54506e8005ef646d994aff8a9d318 100644 (file)
@@ -1114,6 +1114,5 @@ int __init ordered_data_init(void)
 
 void ordered_data_exit(void)
 {
-       if (btrfs_ordered_extent_cache)
-               kmem_cache_destroy(btrfs_ordered_extent_cache);
+       kmem_cache_destroy(btrfs_ordered_extent_cache);
 }