Commit cfbb9308 authored by Chris Mason's avatar Chris Mason

Btrfs: balance btree more often

With the new back reference code, the cost of a balance has gone down
in terms of the number of back reference updates done.  This commit
makes us more aggressively balance leaves and nodes as they become
less full.
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent b3612421
...@@ -1651,7 +1651,7 @@ setup_nodes_for_search(struct btrfs_trans_handle *trans, ...@@ -1651,7 +1651,7 @@ setup_nodes_for_search(struct btrfs_trans_handle *trans,
} }
b = p->nodes[level]; b = p->nodes[level];
} else if (ins_len < 0 && btrfs_header_nritems(b) < } else if (ins_len < 0 && btrfs_header_nritems(b) <
BTRFS_NODEPTRS_PER_BLOCK(root) / 4) { BTRFS_NODEPTRS_PER_BLOCK(root) / 2) {
int sret; int sret;
sret = reada_for_balance(root, p, level); sret = reada_for_balance(root, p, level);
...@@ -3807,7 +3807,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -3807,7 +3807,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
} }
/* delete the leaf if it is mostly empty */ /* delete the leaf if it is mostly empty */
if (used < BTRFS_LEAF_DATA_SIZE(root) / 4) { if (used < BTRFS_LEAF_DATA_SIZE(root) / 2) {
/* push_leaf_left fixes the path. /* push_leaf_left fixes the path.
* make sure the path still points to our leaf * make sure the path still points to our leaf
* for possible call to del_ptr below * for possible call to del_ptr below
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment