btrfs: Test if btrfs will commit too many transactions for balance
authorQu Wenruo <wqu@suse.com>
Tue, 29 Jan 2019 12:32:21 +0000 (20:32 +0800)
committerEryu Guan <guaneryu@gmail.com>
Wed, 30 Jan 2019 01:39:08 +0000 (09:39 +0800)
commit3bea049648f8cf797aac7e85c04f8e8d996fa3cf
treed7c6eadb3b78c5438141f1adf6cb474e55754c66
parent04e1a5e0678b9441fd74dca0f0fad92f9c029670
btrfs: Test if btrfs will commit too many transactions for balance

Kernel commit 64403612b73a ("btrfs: rework
btrfs_check_space_for_delayed_refs") is introducing a regression for
btrfs balance performance.

Since that commit will cause btrfs to commit too many transactions
for nothing during balance/relocation, it will slow balance
dramatically even we only need to relocate several megabytes.

This test case will catch the problem by using super block
generation as failure criteria.

For small chunk relocated, we will commit 6 transactions for each
block group, and the test case should only have 2 block groups, it
should only commit 12 transactions.

This test case will use 120 as the threshold to detect the failure.

And in my test environment, with kernel fix btrfs committed 14
transactions. While without the fix btrfs committed 209
transactions.

So the test case should be enough to detect the regression, while still
keep the runtime small enough for failure.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/btrfs/181 [new file with mode: 0755]
tests/btrfs/181.out [new file with mode: 0644]
tests/btrfs/group