Commit 5598e900 authored by Kinglong Mee's avatar Kinglong Mee Committed by David Sterba

btrfs: drop null testing before destroy functions

Cleanup.

kmem_cache_destroy has support NULL argument checking,
so drop the double null testing before calling it.
Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 89771cc9
...@@ -148,8 +148,7 @@ int __init btrfs_prelim_ref_init(void) ...@@ -148,8 +148,7 @@ int __init btrfs_prelim_ref_init(void)
void btrfs_prelim_ref_exit(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);
} }
/* /*
......
...@@ -43,8 +43,7 @@ int __init btrfs_delayed_inode_init(void) ...@@ -43,8 +43,7 @@ int __init btrfs_delayed_inode_init(void)
void btrfs_delayed_inode_exit(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( static inline void btrfs_init_delayed_node(
......
...@@ -929,14 +929,10 @@ btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr) ...@@ -929,14 +929,10 @@ btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr)
void btrfs_delayed_ref_exit(void) void btrfs_delayed_ref_exit(void)
{ {
if (btrfs_delayed_ref_head_cachep) kmem_cache_destroy(btrfs_delayed_ref_head_cachep);
kmem_cache_destroy(btrfs_delayed_ref_head_cachep); kmem_cache_destroy(btrfs_delayed_tree_ref_cachep);
if (btrfs_delayed_tree_ref_cachep) kmem_cache_destroy(btrfs_delayed_data_ref_cachep);
kmem_cache_destroy(btrfs_delayed_tree_ref_cachep); kmem_cache_destroy(btrfs_delayed_extent_op_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);
} }
int btrfs_delayed_ref_init(void) int btrfs_delayed_ref_init(void)
......
...@@ -110,8 +110,7 @@ int __init btrfs_end_io_wq_init(void) ...@@ -110,8 +110,7 @@ int __init btrfs_end_io_wq_init(void)
void btrfs_end_io_wq_exit(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);
} }
/* /*
......
...@@ -206,10 +206,8 @@ void extent_io_exit(void) ...@@ -206,10 +206,8 @@ void extent_io_exit(void)
* destroy caches. * destroy caches.
*/ */
rcu_barrier(); rcu_barrier();
if (extent_state_cache) kmem_cache_destroy(extent_state_cache);
kmem_cache_destroy(extent_state_cache); kmem_cache_destroy(extent_buffer_cache);
if (extent_buffer_cache)
kmem_cache_destroy(extent_buffer_cache);
if (btrfs_bioset) if (btrfs_bioset)
bioset_free(btrfs_bioset); bioset_free(btrfs_bioset);
} }
......
...@@ -20,8 +20,7 @@ int __init extent_map_init(void) ...@@ -20,8 +20,7 @@ int __init extent_map_init(void)
void extent_map_exit(void) void extent_map_exit(void)
{ {
if (extent_map_cache) kmem_cache_destroy(extent_map_cache);
kmem_cache_destroy(extent_map_cache);
} }
/** /**
......
...@@ -2939,8 +2939,7 @@ const struct file_operations btrfs_file_operations = { ...@@ -2939,8 +2939,7 @@ const struct file_operations btrfs_file_operations = {
void btrfs_auto_defrag_exit(void) 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) int btrfs_auto_defrag_init(void)
......
...@@ -9178,16 +9178,11 @@ void btrfs_destroy_cachep(void) ...@@ -9178,16 +9178,11 @@ void btrfs_destroy_cachep(void)
* destroy cache. * destroy cache.
*/ */
rcu_barrier(); rcu_barrier();
if (btrfs_inode_cachep) kmem_cache_destroy(btrfs_inode_cachep);
kmem_cache_destroy(btrfs_inode_cachep); kmem_cache_destroy(btrfs_trans_handle_cachep);
if (btrfs_trans_handle_cachep) kmem_cache_destroy(btrfs_transaction_cachep);
kmem_cache_destroy(btrfs_trans_handle_cachep); kmem_cache_destroy(btrfs_path_cachep);
if (btrfs_transaction_cachep) kmem_cache_destroy(btrfs_free_space_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);
} }
int btrfs_init_cachep(void) int btrfs_init_cachep(void)
......
...@@ -1114,6 +1114,5 @@ int __init ordered_data_init(void) ...@@ -1114,6 +1114,5 @@ int __init ordered_data_init(void)
void ordered_data_exit(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);
} }
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