[PATCH 2/3] jbd2: code cleanup for jbd2_journal_init_revoke_caches()

From: Chengguang Xu
Date: Sun May 05 2019 - 07:02:07 EST


jbd2_journal_destroy_caches() can handle destruction work
for all caches, so we don't have to destroy previously
created cache in error path, it also makes the code simpler.

Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxx>
---
fs/jbd2/revoke.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index a1143e57a718..3b46b45d085d 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -194,17 +194,14 @@ int __init jbd2_journal_init_revoke_caches(void)
jbd2_revoke_record_cache = KMEM_CACHE(jbd2_revoke_record_s,
SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY);
if (!jbd2_revoke_record_cache)
- goto record_cache_failure;
+ return -ENOMEM;

jbd2_revoke_table_cache = KMEM_CACHE(jbd2_revoke_table_s,
SLAB_TEMPORARY);
if (!jbd2_revoke_table_cache)
- goto table_cache_failure;
- return 0;
-table_cache_failure:
- jbd2_journal_destroy_revoke_caches();
-record_cache_failure:
return -ENOMEM;
+
+ return 0;
}

static struct jbd2_revoke_table_s *jbd2_journal_init_revoke_table(int hash_size)
--
2.20.1