login
Header Space

 
 

Re: [RFC, PATCH 2/6] jbd: replace potentially false assertion with if block

Previous thread: Re: [PATCH 2.6.24] chroot= as a new kernel parameter by Al Boldi on Saturday, March 8, 2008 - 10:10 am. (3 messages)

Next thread: Re: [RFC, PATCH 4/6] jbd: refactor nested journal log recovery loop into separate functions by Christoph Hellwig on Saturday, March 8, 2008 - 10:53 am. (2 messages)
To: Duane Griffin <duaneg@...>
Cc: <linux-ext4@...>, <linux-kernel@...>, Theodore Tso <tytso@...>, <sct@...>, <akpm@...>, <adilger@...>
Date: Saturday, March 8, 2008 - 10:52 am

Actually the whole code surrounding this is far too confusing.  The
patch below converts it much simpler code with proper goto unwinding
for initialization failures:

Index: linux-2.6/fs/jbd/journal.c
===================================================================
--- linux-2.6.orig/fs/jbd/journal.c	2008-03-08 15:43:41.000000000 +0100
+++ linux-2.6/fs/jbd/journal.c	2008-03-08 15:50:44.000000000 +0100
@@ -1615,31 +1615,6 @@ static struct kmem_cache *journal_head_c
 static atomic_t nr_journal_heads = ATOMIC_INIT(0);
 #endif
 
-static int journal_init_journal_head_cache(void)
-{
-	int retval;
-
-	J_ASSERT(journal_head_cache == 0);
-	journal_head_cache = kmem_cache_create("journal_head",
-				sizeof(struct journal_head),
-				0,		/* offset */
-				SLAB_TEMPORARY,	/* flags */
-				NULL);		/* ctor */
-	retval = 0;
-	if (journal_head_cache == 0) {
-		retval = -ENOMEM;
-		printk(KERN_EMERG "JBD: no memory for journal_head cache\n");
-	}
-	return retval;
-}
-
-static void journal_destroy_journal_head_cache(void)
-{
-	J_ASSERT(journal_head_cache != NULL);
-	kmem_cache_destroy(journal_head_cache);
-	journal_head_cache = NULL;
-}
-
 /*
  * journal_head splicing and dicing
  */
@@ -1891,59 +1866,45 @@ static inline void jbd_remove_debugfs_en
 
 struct kmem_cache *jbd_handle_cache;
 
-static int __init journal_init_handle_cache(void)
-{
-	jbd_handle_cache = kmem_cache_create("journal_handle",
-				sizeof(handle_t),
-				0,		/* offset */
-				SLAB_TEMPORARY,	/* flags */
-				NULL);		/* ctor */
-	if (jbd_handle_cache == NULL) {
-		printk(KERN_EMERG "JBD: failed to create handle cache\n");
-		return -ENOMEM;
-	}
-	return 0;
-}
-
-static void journal_destroy_handle_cache(void)
-{
-	if (jbd_handle_cache)
-		kmem_cache_destroy(jbd_handle_cache);
-}
-
 /*
  * Module startup and shutdown
  */
 
-static int __init journal_init_caches(void)
+static int __init journal_init(void)
 {
 	int ret;
 
-	ret = journal_init_revoke_caches();
-	if (ret == 0)
-		ret = j...
Previous thread: Re: [PATCH 2.6.24] chroot= as a new kernel parameter by Al Boldi on Saturday, March 8, 2008 - 10:10 am. (3 messages)

Next thread: Re: [RFC, PATCH 4/6] jbd: refactor nested journal log recovery loop into separate functions by Christoph Hellwig on Saturday, March 8, 2008 - 10:53 am. (2 messages)
speck-geostationary