Group short-lived and reclaimable kernel allocations
[sfrench/cifs-2.6.git] / fs / jbd / journal.c
index e1eb7e999ae832d8dae2030eb6610a6bf7c21a88..a6be78c05dce50420fdf1c08fad3cd80ac5120cd 100644 (file)
@@ -210,10 +210,16 @@ end_loop:
        return 0;
 }
 
-static void journal_start_thread(journal_t *journal)
+static int journal_start_thread(journal_t *journal)
 {
-       kthread_run(kjournald, journal, "kjournald");
+       struct task_struct *t;
+
+       t = kthread_run(kjournald, journal, "kjournald");
+       if (IS_ERR(t))
+               return PTR_ERR(t);
+
        wait_event(journal->j_wait_done_commit, journal->j_task != 0);
+       return 0;
 }
 
 static void journal_kill_thread(journal_t *journal)
@@ -839,8 +845,7 @@ static int journal_reset(journal_t *journal)
 
        /* Add the dynamic fields and write it to disk. */
        journal_update_superblock(journal, 1);
-       journal_start_thread(journal);
-       return 0;
+       return journal_start_thread(journal);
 }
 
 /**
@@ -1663,7 +1668,7 @@ static int journal_create_jbd_slab(size_t slab_size)
         * boundary.
         */
        jbd_slab[i] = kmem_cache_create(jbd_slab_names[i],
-                               slab_size, slab_size, 0, NULL, NULL);
+                               slab_size, slab_size, 0, NULL);
        if (!jbd_slab[i]) {
                printk(KERN_EMERG "JBD: no memory for jbd_slab cache\n");
                return -ENOMEM;
@@ -1705,9 +1710,8 @@ static int journal_init_journal_head_cache(void)
        journal_head_cache = kmem_cache_create("journal_head",
                                sizeof(struct journal_head),
                                0,              /* offset */
-                               0,              /* flags */
-                               NULL,           /* ctor */
-                               NULL);          /* dtor */
+                               SLAB_TEMPORARY, /* flags */
+                               NULL);          /* ctor */
        retval = 0;
        if (journal_head_cache == 0) {
                retval = -ENOMEM;
@@ -2002,9 +2006,8 @@ static int __init journal_init_handle_cache(void)
        jbd_handle_cache = kmem_cache_create("journal_handle",
                                sizeof(handle_t),
                                0,              /* offset */
-                               0,              /* flags */
-                               NULL,           /* ctor */
-                               NULL);          /* dtor */
+                               SLAB_TEMPORARY, /* flags */
+                               NULL);          /* ctor */
        if (jbd_handle_cache == NULL) {
                printk(KERN_EMERG "JBD: failed to create handle cache\n");
                return -ENOMEM;