diff options
Diffstat (limited to 'fs/jbd')
-rw-r--r-- | fs/jbd/revoke.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c index 8ff5a7b89b9a..c7bd649bbbdc 100644 --- a/fs/jbd/revoke.c +++ b/fs/jbd/revoke.c | |||
@@ -166,33 +166,43 @@ static struct jbd_revoke_record_s *find_revoke_record(journal_t *journal, | |||
166 | return NULL; | 166 | return NULL; |
167 | } | 167 | } |
168 | 168 | ||
169 | void journal_destroy_revoke_caches(void) | ||
170 | { | ||
171 | if (revoke_record_cache) { | ||
172 | kmem_cache_destroy(revoke_record_cache); | ||
173 | revoke_record_cache = NULL; | ||
174 | } | ||
175 | if (revoke_table_cache) { | ||
176 | kmem_cache_destroy(revoke_table_cache); | ||
177 | revoke_table_cache = NULL; | ||
178 | } | ||
179 | } | ||
180 | |||
169 | int __init journal_init_revoke_caches(void) | 181 | int __init journal_init_revoke_caches(void) |
170 | { | 182 | { |
183 | J_ASSERT(!revoke_record_cache); | ||
184 | J_ASSERT(!revoke_table_cache); | ||
185 | |||
171 | revoke_record_cache = kmem_cache_create("revoke_record", | 186 | revoke_record_cache = kmem_cache_create("revoke_record", |
172 | sizeof(struct jbd_revoke_record_s), | 187 | sizeof(struct jbd_revoke_record_s), |
173 | 0, | 188 | 0, |
174 | SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY, | 189 | SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY, |
175 | NULL); | 190 | NULL); |
176 | if (!revoke_record_cache) | 191 | if (!revoke_record_cache) |
177 | return -ENOMEM; | 192 | goto record_cache_failure; |
178 | 193 | ||
179 | revoke_table_cache = kmem_cache_create("revoke_table", | 194 | revoke_table_cache = kmem_cache_create("revoke_table", |
180 | sizeof(struct jbd_revoke_table_s), | 195 | sizeof(struct jbd_revoke_table_s), |
181 | 0, SLAB_TEMPORARY, NULL); | 196 | 0, SLAB_TEMPORARY, NULL); |
182 | if (!revoke_table_cache) { | 197 | if (!revoke_table_cache) |
183 | kmem_cache_destroy(revoke_record_cache); | 198 | goto table_cache_failure; |
184 | revoke_record_cache = NULL; | 199 | |
185 | return -ENOMEM; | ||
186 | } | ||
187 | return 0; | 200 | return 0; |
188 | } | ||
189 | 201 | ||
190 | void journal_destroy_revoke_caches(void) | 202 | table_cache_failure: |
191 | { | 203 | journal_destroy_revoke_caches(); |
192 | kmem_cache_destroy(revoke_record_cache); | 204 | record_cache_failure: |
193 | revoke_record_cache = NULL; | 205 | return -ENOMEM; |
194 | kmem_cache_destroy(revoke_table_cache); | ||
195 | revoke_table_cache = NULL; | ||
196 | } | 206 | } |
197 | 207 | ||
198 | static struct jbd_revoke_table_s *journal_init_revoke_table(int hash_size) | 208 | static struct jbd_revoke_table_s *journal_init_revoke_table(int hash_size) |