btrfs: add test case to make sure autodefrag won't give up the whole cluster when there is a hole in it
PATCH 1/1 btrfs: add test case to make sure autodefrag won't give up the whole cluster when there is a hole in it
In v5.11~v5.15 kernels, there is a regression in autodefrag that if a cluster (up to 256K in size) has even a single hole, the whole cluster will be rejected.
This will greatly reduce the efficiency of autodefrag.
The behavior is fixed in v5.16 by a full rework, although the rework itself has other problems, it at least solves this particular regression.
Here we add a test case to reproduce the case, where we have a 128K cluster, the first half is fragmented extents which can be defragged. The second half is hole.
Make sure autodefrag can defrag the 64K part.
This test needs extra debug feature, which is titled:
[RFC] btrfs: sysfs: introduce <uuid>/debug/cleaner_trigger
--- common/btrfs | 11 +++++ tests/btrfs/256 | 112 ++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/256.out | 2 + 3 files changed, 125 insertions(+) create mode 100755 tests/btrfs/256 create mode 100644 tests/btrfs/256.out
common/btrfs +11 -0
@@ -496,3 +496,14 @@ _require_btrfs_support_sectorsize() grep -wq $sectorsize /sys/fs/btrfs/features/supported_sectorsizes || \ _notrun "sectorsize $sectorsize is not supported" } + +# Require trigger for cleaner kthread +_require_btrfs_debug_cleaner_trigger() +{ + local fsid + + fsid=$($BTRFS_UTIL_PROG filesystem show $TEST_DIR | grep uuid: |\ + $AWK_PROG '{print $NF}') + test -f /sys/fs/btrfs/$fsid/debug/cleaner_trigger ||\ + _notrun "no cleaner kthread trigger" +}
tests/btrfs/256 new file +112 -0
112 lines not on this page · raw message
tests/btrfs/256.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 256 +Silence is golden
Signature · 1 line
2.34.1