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>
This commit is contained in:
parent
5d4f98a28c
commit
b361242102
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue