Btrfs: stop avoiding balancing at the end of the transaction.
[safe/jmp/linux-2.6] / fs / btrfs / ctree.c
index 2b96027..2f633e7 100644 (file)
@@ -1052,8 +1052,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
            BTRFS_NODEPTRS_PER_BLOCK(root) / 4)
                return 0;
 
-       if (trans->transaction->delayed_refs.flushing &&
-           btrfs_header_nritems(mid) > 2)
+       if (btrfs_header_nritems(mid) > 2)
                return 0;
 
        if (btrfs_header_nritems(mid) < 2)
@@ -2194,7 +2193,7 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
                ret = insert_new_root(trans, root, path, level + 1);
                if (ret)
                        return ret;
-       } else if (!trans->transaction->delayed_refs.flushing) {
+       } else {
                ret = push_nodes_for_insert(trans, root, path, level);
                c = path->nodes[level];
                if (!ret && btrfs_header_nritems(c) <
@@ -2869,8 +2868,7 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
        int num_doubles = 0;
 
        /* first try to make some room by pushing left and right */
-       if (data_size && ins_key->type != BTRFS_DIR_ITEM_KEY &&
-           !trans->transaction->delayed_refs.flushing) {
+       if (data_size && ins_key->type != BTRFS_DIR_ITEM_KEY) {
                wret = push_leaf_right(trans, root, path, data_size, 0);
                if (wret < 0)
                        return wret;
@@ -3809,8 +3807,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                }
 
                /* delete the leaf if it is mostly empty */
-               if (used < BTRFS_LEAF_DATA_SIZE(root) / 4 &&
-                   !trans->transaction->delayed_refs.flushing) {
+               if (used < BTRFS_LEAF_DATA_SIZE(root) / 4) {
                        /* push_leaf_left fixes the path.
                         * make sure the path still points to our leaf
                         * for possible call to del_ptr below