btrfs: add test to verify the defrag behavior around preallocated extents
PATCH v2 1/1 btrfs: add test to verify the defrag behavior around preallocated extents
Recent v5.16 has some regression around btrfs autodefrag mount option, and the extra scrutiny around defrag code exposes some questionable behavior from the old code.
One behavior is to defrag extents along with the next preallocated extent.
This behavior will cause extra IO and convert all the preallocated extent to regular zero filled extents, rendering the preallocated extent useless.
The kernel fix is titled:
btrfs: defrag: don't try to merge regular extents with preallocated extents
---
Changelog:
v2:
- Add _require_btrfs_support_sectorsize() helper And use it to make sure the platform supports 4k sectorsize
- Use $AWK_PROG to replace awk
--- common/btrfs | 16 +++++++++ tests/btrfs/255 | 84 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/255.out | 2 ++ 3 files changed, 102 insertions(+) create mode 100755 tests/btrfs/255 create mode 100644 tests/btrfs/255.out
common/btrfs +16 -0
@@ -480,3 +480,19 @@ _btrfs_no_v1_cache_opt() fi echo -n "-onospace_cache" } + +# Require certain sectorsize support +_require_btrfs_support_sectorsize() +{ + local sectorsize=$1 + + # PAGE_SIZE as sectorsize is always supported + if [ $sectorsize -eq $(get_page_size) ]; then + return + fi + + test -f /sys/fs/btrfs/features/supported_sectorsizes || \ + _notrun "no subpage support found" + grep -wq $sectorsize /sys/fs/btrfs/features/supported_sectorsizes || \ + _notrun "sectorsize $sectorsize is not supported" +}
tests/btrfs/255 new file +84 -0
84 lines not on this page · raw message
tests/btrfs/255.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 255 +Silence is golden
Signature · 1 line
2.34.1