jbd2: use non-racy method for proc entries creation
[pandora-kernel.git] / fs / jbd2 / journal.c
index 96ba846..eb7eb6c 100644 (file)
@@ -219,7 +219,7 @@ static int jbd2_journal_start_thread(journal_t *journal)
        if (IS_ERR(t))
                return PTR_ERR(t);
 
-       wait_event(journal->j_wait_done_commit, journal->j_task != 0);
+       wait_event(journal->j_wait_done_commit, journal->j_task != NULL);
        return 0;
 }
 
@@ -231,7 +231,7 @@ static void journal_kill_thread(journal_t *journal)
        while (journal->j_task) {
                wake_up(&journal->j_wait_commit);
                spin_unlock(&journal->j_state_lock);
-               wait_event(journal->j_wait_done_commit, journal->j_task == 0);
+               wait_event(journal->j_wait_done_commit, journal->j_task == NULL);
                spin_lock(&journal->j_state_lock);
        }
        spin_unlock(&journal->j_state_lock);
@@ -904,19 +904,10 @@ static void jbd2_stats_proc_init(journal_t *journal)
        snprintf(name, sizeof(name) - 1, "%s", bdevname(journal->j_dev, name));
        journal->j_proc_entry = proc_mkdir(name, proc_jbd2_stats);
        if (journal->j_proc_entry) {
-               struct proc_dir_entry *p;
-               p = create_proc_entry("history", S_IRUGO,
-                               journal->j_proc_entry);
-               if (p) {
-                       p->proc_fops = &jbd2_seq_history_fops;
-                       p->data = journal;
-                       p = create_proc_entry("info", S_IRUGO,
-                                               journal->j_proc_entry);
-                       if (p) {
-                               p->proc_fops = &jbd2_seq_info_fops;
-                               p->data = journal;
-                       }
-               }
+               proc_create_data("history", S_IRUGO, journal->j_proc_entry,
+                                &jbd2_seq_history_fops, journal);
+               proc_create_data("info", S_IRUGO, journal->j_proc_entry,
+                                &jbd2_seq_info_fops, journal);
        }
 }
 
@@ -1969,14 +1960,14 @@ static int journal_init_jbd2_journal_head_cache(void)
 {
        int retval;
 
-       J_ASSERT(jbd2_journal_head_cache == 0);
+       J_ASSERT(jbd2_journal_head_cache == NULL);
        jbd2_journal_head_cache = kmem_cache_create("jbd2_journal_head",
                                sizeof(struct journal_head),
                                0,              /* offset */
                                SLAB_TEMPORARY, /* flags */
                                NULL);          /* ctor */
        retval = 0;
-       if (jbd2_journal_head_cache == 0) {
+       if (!jbd2_journal_head_cache) {
                retval = -ENOMEM;
                printk(KERN_EMERG "JBD: no memory for journal_head cache\n");
        }
@@ -2002,14 +1993,14 @@ static struct journal_head *journal_alloc_journal_head(void)
        atomic_inc(&nr_journal_heads);
 #endif
        ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS);
-       if (ret == 0) {
+       if (!ret) {
                jbd_debug(1, "out of memory for journal_head\n");
                if (time_after(jiffies, last_warning + 5*HZ)) {
                        printk(KERN_NOTICE "ENOMEM in %s, retrying.\n",
                               __FUNCTION__);
                        last_warning = jiffies;
                }
-               while (ret == 0) {
+               while (!ret) {
                        yield();
                        ret = kmem_cache_alloc(jbd2_journal_head_cache, GFP_NOFS);
                }