aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2009-05-13 19:12:15 -0400
committerChris Mason <chris.mason@oracle.com>2009-06-10 11:29:47 -0400
commitb36124210248706186a02093427bdff4b3f548e8 (patch)
tree42859bcab04454fe639f39ddbf65f9c408e6bbbc /fs
parent5d4f98a28c7d334091c1b7744f48a1acdd2a4ae0 (diff)
Btrfs: stop avoiding balancing at the end of the transaction.
When the delayed reference code was added, some checks were added to avoid extra balancing while the delayed references were being flushed. This made for less efficient btrees, but it reduced the chances of loops where no forward progress was made because the balances made more delayed ref updates. With the new dead root removal code and the mixed back references, the extent allocation tree is no longer using precise back refs, and the delayed reference updates don't carry the risk of looping forever anymore. So, the balance avoidance is no longer required. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 2b960278a2f9..2f633e751198 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1052,8 +1052,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
1052 BTRFS_NODEPTRS_PER_BLOCK(root) / 4) 1052 BTRFS_NODEPTRS_PER_BLOCK(root) / 4)
1053 return 0; 1053 return 0;
1054 1054
1055 if (trans->transaction->delayed_refs.flushing && 1055 if (btrfs_header_nritems(mid) > 2)
1056 btrfs_header_nritems(mid) > 2)
1057 return 0; 1056 return 0;
1058 1057
1059 if (btrfs_header_nritems(mid) < 2) 1058 if (btrfs_header_nritems(mid) < 2)
@@ -2194,7 +2193,7 @@ static noinline int split_node(struct btrfs_trans_handle *trans,
2194 ret = insert_new_root(trans, root, path, level + 1); 2193 ret = insert_new_root(trans, root, path, level + 1);
2195 if (ret) 2194 if (ret)
2196 return ret; 2195 return ret;
2197 } else if (!trans->transaction->delayed_refs.flushing) { 2196 } else {
2198 ret = push_nodes_for_insert(trans, root, path, level); 2197 ret = push_nodes_for_insert(trans, root, path, level);
2199 c = path->nodes[level]; 2198 c = path->nodes[level];
2200 if (!ret && btrfs_header_nritems(c) < 2199 if (!ret && btrfs_header_nritems(c) <
@@ -2869,8 +2868,7 @@ static noinline int split_leaf(struct btrfs_trans_handle *trans,
2869 int num_doubles = 0; 2868 int num_doubles = 0;
2870 2869
2871 /* first try to make some room by pushing left and right */ 2870 /* first try to make some room by pushing left and right */
2872 if (data_size && ins_key->type != BTRFS_DIR_ITEM_KEY && 2871 if (data_size && ins_key->type != BTRFS_DIR_ITEM_KEY) {
2873 !trans->transaction->delayed_refs.flushing) {
2874 wret = push_leaf_right(trans, root, path, data_size, 0); 2872 wret = push_leaf_right(trans, root, path, data_size, 0);
2875 if (wret < 0) 2873 if (wret < 0)
2876 return wret; 2874 return wret;
@@ -3809,8 +3807,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
3809 } 3807 }
3810 3808
3811 /* delete the leaf if it is mostly empty */ 3809 /* delete the leaf if it is mostly empty */
3812 if (used < BTRFS_LEAF_DATA_SIZE(root) / 4 && 3810 if (used < BTRFS_LEAF_DATA_SIZE(root) / 4) {
3813 !trans->transaction->delayed_refs.flushing) {
3814 /* push_leaf_left fixes the path. 3811 /* push_leaf_left fixes the path.
3815 * make sure the path still points to our leaf 3812 * make sure the path still points to our leaf
3816 * for possible call to del_ptr below 3813 * for possible call to del_ptr below