]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/301: skip extent count check on btrfs
authorLeo Martins <loemra.dev@gmail.com>
Tue, 24 Mar 2026 20:40:00 +0000 (13:40 -0700)
committerZorro Lang <zlang@kernel.org>
Wed, 1 Apr 2026 15:07:08 +0000 (23:07 +0800)
The 2/3 fragmentation threshold was designed for XFS's cowextsize
mechanism and is not applicable to btrfs. After commit 0dc118b3c327
("btrfs: be less aggressive with metadata overcommit when we can do
full flushing"), btrfs commits transactions more frequently during
writeback, reducing the extent allocator's opportunity to coalesce
adjacent CoW extents. This causes the extent count to sometimes cross
the threshold, making the test flaky on btrfs.

Skip only the extent count assertion for btrfs while keeping the CoW
write + remount + md5sum data integrity checks, which remain useful.

Signed-off-by: Leo Martins <loemra.dev@gmail.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/301

index 0303f25d99f23069ec068b991e92aa689d3afd86..3e9798ec7e1659d085a6db0405e4b7c9e71bae08 100755 (executable)
@@ -62,7 +62,13 @@ new_extents=$(_count_extents $testdir/file2)
 echo "old extents: $old_extents" >> $seqres.full
 echo "new extents: $new_extents" >> $seqres.full
 echo "maximum extents: $internal_blks" >> $seqres.full
-test $new_extents -lt $((internal_blks * 2 / 3)) || echo "file2 badly fragmented"
+# btrfs CoW extent allocation depends on transaction commit frequency and
+# metadata reservation behavior, so the 2/3 fragmentation threshold (designed
+# for XFS cowextsize) is not applicable.
+if [ "$FSTYP" != "btrfs" ]; then
+       test $new_extents -lt $((internal_blks * 2 / 3)) || \
+               echo "file2 badly fragmented"
+fi
 
 # success, all done
 status=0