diff options
author | Kinglong Mee <kinglongmee@gmail.com> | 2016-01-29 08:36:35 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-02-18 05:46:03 -0500 |
commit | 5598e9005a4076d6700bbd89d0cdbe5b2922a846 (patch) | |
tree | f0d5eb3931d5c990d23dabc39458248cbda6fbe2 | |
parent | 89771cc98c5a4e8666e479dde171ffb52c6fa774 (diff) |
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: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/backref.c | 3 | ||||
-rw-r--r-- | fs/btrfs/delayed-inode.c | 3 | ||||
-rw-r--r-- | fs/btrfs/delayed-ref.c | 12 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 3 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 6 | ||||
-rw-r--r-- | fs/btrfs/extent_map.c | 3 | ||||
-rw-r--r-- | fs/btrfs/file.c | 3 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 15 | ||||
-rw-r--r-- | fs/btrfs/ordered-data.c | 3 |
9 files changed, 17 insertions, 34 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index dc6e9a32d019..447d0ac736db 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -148,8 +148,7 @@ int __init btrfs_prelim_ref_init(void) | |||
148 | 148 | ||
149 | void btrfs_prelim_ref_exit(void) | 149 | void btrfs_prelim_ref_exit(void) |
150 | { | 150 | { |
151 | if (btrfs_prelim_ref_cache) | 151 | kmem_cache_destroy(btrfs_prelim_ref_cache); |
152 | kmem_cache_destroy(btrfs_prelim_ref_cache); | ||
153 | } | 152 | } |
154 | 153 | ||
155 | /* | 154 | /* |
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 0be47e4b8136..716a4ec77332 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c | |||
@@ -43,8 +43,7 @@ int __init btrfs_delayed_inode_init(void) | |||
43 | 43 | ||
44 | void btrfs_delayed_inode_exit(void) | 44 | void btrfs_delayed_inode_exit(void) |
45 | { | 45 | { |
46 | if (delayed_node_cache) | 46 | kmem_cache_destroy(delayed_node_cache); |
47 | kmem_cache_destroy(delayed_node_cache); | ||
48 | } | 47 | } |
49 | 48 | ||
50 | static inline void btrfs_init_delayed_node( | 49 | static inline void btrfs_init_delayed_node( |
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index 914ac13bd92f..430b3689b112 100644 --- a/fs/btrfs/delayed-ref.c +++ b/fs/btrfs/delayed-ref.c | |||
@@ -929,14 +929,10 @@ btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr) | |||
929 | 929 | ||
930 | void btrfs_delayed_ref_exit(void) | 930 | void btrfs_delayed_ref_exit(void) |
931 | { | 931 | { |
932 | if (btrfs_delayed_ref_head_cachep) | 932 | kmem_cache_destroy(btrfs_delayed_ref_head_cachep); |
933 | kmem_cache_destroy(btrfs_delayed_ref_head_cachep); | 933 | kmem_cache_destroy(btrfs_delayed_tree_ref_cachep); |
934 | if (btrfs_delayed_tree_ref_cachep) | 934 | kmem_cache_destroy(btrfs_delayed_data_ref_cachep); |
935 | kmem_cache_destroy(btrfs_delayed_tree_ref_cachep); | 935 | kmem_cache_destroy(btrfs_delayed_extent_op_cachep); |
936 | if (btrfs_delayed_data_ref_cachep) | ||
937 | kmem_cache_destroy(btrfs_delayed_data_ref_cachep); | ||
938 | if (btrfs_delayed_extent_op_cachep) | ||
939 | kmem_cache_destroy(btrfs_delayed_extent_op_cachep); | ||
940 | } | 936 | } |
941 | 937 | ||
942 | int btrfs_delayed_ref_init(void) | 938 | int btrfs_delayed_ref_init(void) |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 4545e2e2ad45..19f8e5bd7dfb 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -110,8 +110,7 @@ int __init btrfs_end_io_wq_init(void) | |||
110 | 110 | ||
111 | void btrfs_end_io_wq_exit(void) | 111 | void btrfs_end_io_wq_exit(void) |
112 | { | 112 | { |
113 | if (btrfs_end_io_wq_cache) | 113 | kmem_cache_destroy(btrfs_end_io_wq_cache); |
114 | kmem_cache_destroy(btrfs_end_io_wq_cache); | ||
115 | } | 114 | } |
116 | 115 | ||
117 | /* | 116 | /* |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index f3910ac00d89..96d24d049797 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -206,10 +206,8 @@ void extent_io_exit(void) | |||
206 | * destroy caches. | 206 | * destroy caches. |
207 | */ | 207 | */ |
208 | rcu_barrier(); | 208 | rcu_barrier(); |
209 | if (extent_state_cache) | 209 | kmem_cache_destroy(extent_state_cache); |
210 | kmem_cache_destroy(extent_state_cache); | 210 | kmem_cache_destroy(extent_buffer_cache); |
211 | if (extent_buffer_cache) | ||
212 | kmem_cache_destroy(extent_buffer_cache); | ||
213 | if (btrfs_bioset) | 211 | if (btrfs_bioset) |
214 | bioset_free(btrfs_bioset); | 212 | bioset_free(btrfs_bioset); |
215 | } | 213 | } |
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 84fb56d5c018..cdbadeaef202 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -20,8 +20,7 @@ int __init extent_map_init(void) | |||
20 | 20 | ||
21 | void extent_map_exit(void) | 21 | void extent_map_exit(void) |
22 | { | 22 | { |
23 | if (extent_map_cache) | 23 | kmem_cache_destroy(extent_map_cache); |
24 | kmem_cache_destroy(extent_map_cache); | ||
25 | } | 24 | } |
26 | 25 | ||
27 | /** | 26 | /** |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 610f56992464..b387fb53a880 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -2939,8 +2939,7 @@ const struct file_operations btrfs_file_operations = { | |||
2939 | 2939 | ||
2940 | void btrfs_auto_defrag_exit(void) | 2940 | void btrfs_auto_defrag_exit(void) |
2941 | { | 2941 | { |
2942 | if (btrfs_inode_defrag_cachep) | 2942 | kmem_cache_destroy(btrfs_inode_defrag_cachep); |
2943 | kmem_cache_destroy(btrfs_inode_defrag_cachep); | ||
2944 | } | 2943 | } |
2945 | 2944 | ||
2946 | int btrfs_auto_defrag_init(void) | 2945 | int btrfs_auto_defrag_init(void) |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index cf0b3795364a..f067c77425bd 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -9178,16 +9178,11 @@ void btrfs_destroy_cachep(void) | |||
9178 | * destroy cache. | 9178 | * destroy cache. |
9179 | */ | 9179 | */ |
9180 | rcu_barrier(); | 9180 | rcu_barrier(); |
9181 | if (btrfs_inode_cachep) | 9181 | kmem_cache_destroy(btrfs_inode_cachep); |
9182 | kmem_cache_destroy(btrfs_inode_cachep); | 9182 | kmem_cache_destroy(btrfs_trans_handle_cachep); |
9183 | if (btrfs_trans_handle_cachep) | 9183 | kmem_cache_destroy(btrfs_transaction_cachep); |
9184 | kmem_cache_destroy(btrfs_trans_handle_cachep); | 9184 | kmem_cache_destroy(btrfs_path_cachep); |
9185 | if (btrfs_transaction_cachep) | 9185 | kmem_cache_destroy(btrfs_free_space_cachep); |
9186 | kmem_cache_destroy(btrfs_transaction_cachep); | ||
9187 | if (btrfs_path_cachep) | ||
9188 | kmem_cache_destroy(btrfs_path_cachep); | ||
9189 | if (btrfs_free_space_cachep) | ||
9190 | kmem_cache_destroy(btrfs_free_space_cachep); | ||
9191 | } | 9186 | } |
9192 | 9187 | ||
9193 | int btrfs_init_cachep(void) | 9188 | int btrfs_init_cachep(void) |
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c index 8c27292ea9ea..988eb1513aa5 100644 --- a/fs/btrfs/ordered-data.c +++ b/fs/btrfs/ordered-data.c | |||
@@ -1114,6 +1114,5 @@ int __init ordered_data_init(void) | |||
1114 | 1114 | ||
1115 | void ordered_data_exit(void) | 1115 | void ordered_data_exit(void) |
1116 | { | 1116 | { |
1117 | if (btrfs_ordered_extent_cache) | 1117 | kmem_cache_destroy(btrfs_ordered_extent_cache); |
1118 | kmem_cache_destroy(btrfs_ordered_extent_cache); | ||
1119 | } | 1118 | } |