]> Pileus Git - ~andy/linux/blobdiff - fs/ubifs/tnc_commit.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[~andy/linux] / fs / ubifs / tnc_commit.c
index 8117e65ba2e99e4523a59abd6d03923cbc354861..fde8d127c768d11c6b16087f4a2a6437b729c1d1 100644 (file)
@@ -372,26 +372,25 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt)
                written = layout_leb_in_gaps(c, p);
                if (written < 0) {
                        err = written;
-                       if (err == -ENOSPC) {
-                               if (!dbg_force_in_the_gaps_enabled) {
-                                       /*
-                                        * Do not print scary warnings if the
-                                        * debugging option which forces
-                                        * in-the-gaps is enabled.
-                                        */
-                                       ubifs_err("out of space");
-                                       spin_lock(&c->space_lock);
-                                       dbg_dump_budg(c);
-                                       spin_unlock(&c->space_lock);
-                                       dbg_dump_lprops(c);
-                               }
-                               /* Try to commit anyway */
-                               err = 0;
-                               break;
+                       if (err != -ENOSPC) {
+                               kfree(c->gap_lebs);
+                               c->gap_lebs = NULL;
+                               return err;
                        }
-                       kfree(c->gap_lebs);
-                       c->gap_lebs = NULL;
-                       return err;
+                       if (!dbg_force_in_the_gaps_enabled) {
+                               /*
+                                * Do not print scary warnings if the debugging
+                                * option which forces in-the-gaps is enabled.
+                                */
+                               ubifs_err("out of space");
+                               spin_lock(&c->space_lock);
+                               dbg_dump_budg(c);
+                               spin_unlock(&c->space_lock);
+                               dbg_dump_lprops(c);
+                       }
+                       /* Try to commit anyway */
+                       err = 0;
+                       break;
                }
                p++;
                cnt -= written;
@@ -554,8 +553,8 @@ static int layout_in_empty_space(struct ubifs_info *c)
        }
 
 #ifdef CONFIG_UBIFS_FS_DEBUG
-       c->new_ihead_lnum = lnum;
-       c->new_ihead_offs = buf_offs;
+       c->dbg->new_ihead_lnum = lnum;
+       c->dbg->new_ihead_offs = buf_offs;
 #endif
 
        return 0;
@@ -803,8 +802,10 @@ int ubifs_tnc_start_commit(struct ubifs_info *c, struct ubifs_zbranch *zroot)
         * budgeting subsystem to assume the index is already committed,
         * even though it is not.
         */
+       ubifs_assert(c->min_idx_lebs == ubifs_calc_min_idx_lebs(c));
        c->old_idx_sz = c->calc_idx_sz;
        c->budg_uncommitted_idx = 0;
+       c->min_idx_lebs = ubifs_calc_min_idx_lebs(c);
        spin_unlock(&c->space_lock);
        mutex_unlock(&c->tnc_mutex);
 
@@ -1003,7 +1004,8 @@ static int write_index(struct ubifs_info *c)
        }
 
 #ifdef CONFIG_UBIFS_FS_DEBUG
-       if (lnum != c->new_ihead_lnum || buf_offs != c->new_ihead_offs) {
+       if (lnum != c->dbg->new_ihead_lnum ||
+           buf_offs != c->dbg->new_ihead_offs) {
                ubifs_err("inconsistent ihead");
                return -EINVAL;
        }