JFS: Free sbi memory in error path
[safe/jmp/linux-2.6] / fs / ubifs / commit.c
index 0a6aa2c..37fa7ed 100644 (file)
@@ -45,6 +45,7 @@
 
 #include <linux/freezer.h>
 #include <linux/kthread.h>
+#include <linux/slab.h>
 #include "ubifs.h"
 
 /**
@@ -234,8 +235,8 @@ int ubifs_bg_thread(void *info)
        int err;
        struct ubifs_info *c = info;
 
-       ubifs_msg("background thread \"%s\" started, PID %d",
-                 c->bgt_name, current->pid);
+       dbg_msg("background thread \"%s\" started, PID %d",
+               c->bgt_name, current->pid);
        set_freezable();
 
        while (1) {
@@ -470,12 +471,12 @@ int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot)
 {
        struct ubifs_idx_node *idx;
        int lnum, offs, len, err = 0;
+       struct ubifs_debug_info *d = c->dbg;
 
-       c->old_zroot = *zroot;
-
-       lnum = c->old_zroot.lnum;
-       offs = c->old_zroot.offs;
-       len = c->old_zroot.len;
+       d->old_zroot = *zroot;
+       lnum = d->old_zroot.lnum;
+       offs = d->old_zroot.offs;
+       len = d->old_zroot.len;
 
        idx = kmalloc(c->max_idx_node_sz, GFP_NOFS);
        if (!idx)
@@ -485,8 +486,8 @@ int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot)
        if (err)
                goto out;
 
-       c->old_zroot_level = le16_to_cpu(idx->level);
-       c->old_zroot_sqnum = le64_to_cpu(idx->ch.sqnum);
+       d->old_zroot_level = le16_to_cpu(idx->level);
+       d->old_zroot_sqnum = le64_to_cpu(idx->ch.sqnum);
 out:
        kfree(idx);
        return err;
@@ -509,7 +510,8 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
 {
        int lnum, offs, len, err = 0, uninitialized_var(last_level), child_cnt;
        int first = 1, iip;
-       union ubifs_key lower_key, upper_key, l_key, u_key;
+       struct ubifs_debug_info *d = c->dbg;
+       union ubifs_key uninitialized_var(lower_key), upper_key, l_key, u_key;
        unsigned long long uninitialized_var(last_sqnum);
        struct ubifs_idx_node *idx;
        struct list_head list;
@@ -525,9 +527,9 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
             UBIFS_IDX_NODE_SZ;
 
        /* Start at the old zroot */
-       lnum = c->old_zroot.lnum;
-       offs = c->old_zroot.offs;
-       len = c->old_zroot.len;
+       lnum = d->old_zroot.lnum;
+       offs = d->old_zroot.offs;
+       len = d->old_zroot.len;
        iip = 0;
 
        /*
@@ -560,11 +562,11 @@ int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot)
                if (first) {
                        first = 0;
                        /* Check root level and sqnum */
-                       if (le16_to_cpu(idx->level) != c->old_zroot_level) {
+                       if (le16_to_cpu(idx->level) != d->old_zroot_level) {
                                err = 2;
                                goto out_dump;
                        }
-                       if (le64_to_cpu(idx->ch.sqnum) != c->old_zroot_sqnum) {
+                       if (le64_to_cpu(idx->ch.sqnum) != d->old_zroot_sqnum) {
                                err = 3;
                                goto out_dump;
                        }