Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jlbec/ocfs2
[safe/jmp/linux-2.6] / fs / reiserfs / fix_node.c
index bf5f2cb..1e4250b 100644 (file)
@@ -35,6 +35,7 @@
  **/
 
 #include <linux/time.h>
+#include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/reiserfs_fs.h>
 #include <linux/buffer_head.h>
@@ -563,9 +564,6 @@ static int get_num_ver(int mode, struct tree_balance *tb, int h,
        return needed_nodes;
 }
 
-#ifdef CONFIG_REISERFS_CHECK
-extern struct tree_balance *cur_tb;
-#endif
 
 /* Set parameters for balancing.
  * Performs write of results of analysis of balancing into structure tb,
@@ -834,7 +832,7 @@ static int get_empty_nodes(struct tree_balance *tb, int h)
                RFALSE(buffer_dirty(new_bh) ||
                       buffer_journaled(new_bh) ||
                       buffer_journal_dirty(new_bh),
-                      "PAP-8140: journlaled or dirty buffer %b for the new block",
+                      "PAP-8140: journaled or dirty buffer %b for the new block",
                       new_bh);
 
                /* Put empty buffers into the array. */
@@ -1971,7 +1969,9 @@ static int get_neighbors(struct tree_balance *tb, int h)
                     tb->FL[h]) ? tb->lkey[h] : B_NR_ITEMS(tb->
                                                                       FL[h]);
                son_number = B_N_CHILD_NUM(tb->FL[h], child_position);
+               reiserfs_write_unlock(sb);
                bh = sb_bread(sb, son_number);
+               reiserfs_write_lock(sb);
                if (!bh)
                        return IO_ERROR;
                if (FILESYSTEM_CHANGED_TB(tb)) {
@@ -2009,7 +2009,9 @@ static int get_neighbors(struct tree_balance *tb, int h)
                child_position =
                    (bh == tb->FR[h]) ? tb->rkey[h] + 1 : 0;
                son_number = B_N_CHILD_NUM(tb->FR[h], child_position);
+               reiserfs_write_unlock(sb);
                bh = sb_bread(sb, son_number);
+               reiserfs_write_lock(sb);
                if (!bh)
                        return IO_ERROR;
                if (FILESYSTEM_CHANGED_TB(tb)) {
@@ -2364,7 +2366,7 @@ int fix_nodes(int op_mode, struct tree_balance *tb,
                        return REPEAT_SEARCH;
        }
 #ifdef CONFIG_REISERFS_CHECK
-       if (cur_tb) {
+       if (REISERFS_SB(tb->tb_sb)->cur_tb) {
                print_cur_tb("fix_nodes");
                reiserfs_panic(tb->tb_sb, "PAP-8305",
                               "there is pending do_balance");