Commit c4140cbf authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba

btrfs: qgroup: Don't scan leaf if we're modifying reloc tree

Since reloc tree doesn't contribute to qgroup numbers, just skip them.

This should catch the final cause of unnecessary data ref processing
when running balance of metadata with qgroups on.

The 4G data 16 snapshots test (*) should explain it pretty well:

             | delayed subtree | refactor delayed ref | this patch
---------------------------------------------------------------------
relocated    |           22653 |                22673 |         22744
qgroup dirty |          122792 |                48360 |            70
time         |          24.494 |               11.606 |         3.944

Finally, we're at the stage where qgroup + metadata balance cost no
obvious overhead.

Test environment:

Test VM:
- vRAM		8G
- vCPU		8
- block dev	vitrio-blk, 'unsafe' cache mode
- host block	850evo

Test workload:
- Copy 4G data from /usr/ to one subvolume
- Create 16 snapshots of that subvolume, and modify 3 files in each
  snapshot
- Enable quota, rescan
- Time "btrfs balance start -m"
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent ffd4bb2a
...@@ -9141,11 +9141,13 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans, ...@@ -9141,11 +9141,13 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
else else
ret = btrfs_dec_ref(trans, root, eb, 0); ret = btrfs_dec_ref(trans, root, eb, 0);
BUG_ON(ret); /* -ENOMEM */ BUG_ON(ret); /* -ENOMEM */
ret = btrfs_qgroup_trace_leaf_items(trans, eb); if (is_fstree(root->root_key.objectid)) {
if (ret) { ret = btrfs_qgroup_trace_leaf_items(trans, eb);
btrfs_err_rl(fs_info, if (ret) {
"error %d accounting leaf items. Quota is out of sync, rescan required.", btrfs_err_rl(fs_info,
"error %d accounting leaf items, quota is out of sync, rescan required",
ret); ret);
}
} }
} }
/* make block locked assertion in btrfs_clean_tree_block happy */ /* make block locked assertion in btrfs_clean_tree_block happy */
......
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