]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/jbd/revoke.c
PCI: add routines for debugging and handling lost interrupts
[linux-2.6-omap-h63xx.git] / fs / jbd / revoke.c
index 8ff5a7b89b9ae6ef852b86f62d32e1de6b0b8b7c..c7bd649bbbdcfe032c46c52ed235bfda7a5e40e9 100644 (file)
@@ -166,33 +166,43 @@ static struct jbd_revoke_record_s *find_revoke_record(journal_t *journal,
        return NULL;
 }
 
+void journal_destroy_revoke_caches(void)
+{
+       if (revoke_record_cache) {
+               kmem_cache_destroy(revoke_record_cache);
+               revoke_record_cache = NULL;
+       }
+       if (revoke_table_cache) {
+               kmem_cache_destroy(revoke_table_cache);
+               revoke_table_cache = NULL;
+       }
+}
+
 int __init journal_init_revoke_caches(void)
 {
+       J_ASSERT(!revoke_record_cache);
+       J_ASSERT(!revoke_table_cache);
+
        revoke_record_cache = kmem_cache_create("revoke_record",
                                           sizeof(struct jbd_revoke_record_s),
                                           0,
                                           SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY,
                                           NULL);
        if (!revoke_record_cache)
-               return -ENOMEM;
+               goto record_cache_failure;
 
        revoke_table_cache = kmem_cache_create("revoke_table",
                                           sizeof(struct jbd_revoke_table_s),
                                           0, SLAB_TEMPORARY, NULL);
-       if (!revoke_table_cache) {
-               kmem_cache_destroy(revoke_record_cache);
-               revoke_record_cache = NULL;
-               return -ENOMEM;
-       }
+       if (!revoke_table_cache)
+               goto table_cache_failure;
+
        return 0;
-}
 
-void journal_destroy_revoke_caches(void)
-{
-       kmem_cache_destroy(revoke_record_cache);
-       revoke_record_cache = NULL;
-       kmem_cache_destroy(revoke_table_cache);
-       revoke_table_cache = NULL;
+table_cache_failure:
+       journal_destroy_revoke_caches();
+record_cache_failure:
+       return -ENOMEM;
 }
 
 static struct jbd_revoke_table_s *journal_init_revoke_table(int hash_size)