diff options
Diffstat (limited to 'fs/gfs2/main.c')
-rw-r--r-- | fs/gfs2/main.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index a8d9bcd0e19c..754426b1e52c 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/rcupdate.h> | 17 | #include <linux/rcupdate.h> |
18 | #include <linux/rculist_bl.h> | 18 | #include <linux/rculist_bl.h> |
19 | #include <linux/atomic.h> | 19 | #include <linux/atomic.h> |
20 | #include <linux/mempool.h> | ||
20 | 21 | ||
21 | #include "gfs2.h" | 22 | #include "gfs2.h" |
22 | #include "incore.h" | 23 | #include "incore.h" |
@@ -69,6 +70,16 @@ static void gfs2_init_gl_aspace_once(void *foo) | |||
69 | address_space_init_once(mapping); | 70 | address_space_init_once(mapping); |
70 | } | 71 | } |
71 | 72 | ||
73 | static void *gfs2_bh_alloc(gfp_t mask, void *data) | ||
74 | { | ||
75 | return alloc_buffer_head(mask); | ||
76 | } | ||
77 | |||
78 | static void gfs2_bh_free(void *ptr, void *data) | ||
79 | { | ||
80 | return free_buffer_head(ptr); | ||
81 | } | ||
82 | |||
72 | /** | 83 | /** |
73 | * init_gfs2_fs - Register GFS2 as a filesystem | 84 | * init_gfs2_fs - Register GFS2 as a filesystem |
74 | * | 85 | * |
@@ -151,6 +162,10 @@ static int __init init_gfs2_fs(void) | |||
151 | gfs2_control_wq = alloc_workqueue("gfs2_control", | 162 | gfs2_control_wq = alloc_workqueue("gfs2_control", |
152 | WQ_NON_REENTRANT | WQ_UNBOUND | WQ_FREEZABLE, 0); | 163 | WQ_NON_REENTRANT | WQ_UNBOUND | WQ_FREEZABLE, 0); |
153 | if (!gfs2_control_wq) | 164 | if (!gfs2_control_wq) |
165 | goto fail_recovery; | ||
166 | |||
167 | gfs2_bh_pool = mempool_create(1024, gfs2_bh_alloc, gfs2_bh_free, NULL); | ||
168 | if (!gfs2_bh_pool) | ||
154 | goto fail_control; | 169 | goto fail_control; |
155 | 170 | ||
156 | gfs2_register_debugfs(); | 171 | gfs2_register_debugfs(); |
@@ -160,6 +175,8 @@ static int __init init_gfs2_fs(void) | |||
160 | return 0; | 175 | return 0; |
161 | 176 | ||
162 | fail_control: | 177 | fail_control: |
178 | destroy_workqueue(gfs2_control_wq); | ||
179 | fail_recovery: | ||
163 | destroy_workqueue(gfs_recovery_wq); | 180 | destroy_workqueue(gfs_recovery_wq); |
164 | fail_wq: | 181 | fail_wq: |
165 | unregister_filesystem(&gfs2meta_fs_type); | 182 | unregister_filesystem(&gfs2meta_fs_type); |
@@ -208,6 +225,7 @@ static void __exit exit_gfs2_fs(void) | |||
208 | 225 | ||
209 | rcu_barrier(); | 226 | rcu_barrier(); |
210 | 227 | ||
228 | mempool_destroy(gfs2_bh_pool); | ||
211 | kmem_cache_destroy(gfs2_quotad_cachep); | 229 | kmem_cache_destroy(gfs2_quotad_cachep); |
212 | kmem_cache_destroy(gfs2_rgrpd_cachep); | 230 | kmem_cache_destroy(gfs2_rgrpd_cachep); |
213 | kmem_cache_destroy(gfs2_bufdata_cachep); | 231 | kmem_cache_destroy(gfs2_bufdata_cachep); |