Re: [PATCH] generic/365: Fix false failure when mapping ends with free space
From: Disha Goel
Date: Thu Aug 21 2025 - 07:05:47 EST
On 05/08/25 2:55 pm, Ojaswin Mujoo wrote:
If we have a small FS where the first free space mapping is also the
last mapping of the FS, then the following sub-test fails:
echo "test whatever came after freesp"
$XFS_IO_PROG -c "fsmap -d $((freesp_end + 2)) $((freesp_end + 3))" $SCRATCH_MNT
since there is nothing after the freespace. Fix this by punching a 1M
hole in a 3M file to ensure that the first free space is always
surrounded by allocated blocks.
Signed-off-by: Ojaswin Mujoo <ojaswin@xxxxxxxxxxxxx>
I tested the patch on Power, and it resolves the test failures with a
64k block size.
Tested-by: Disha Goel <disgoel@xxxxxxxxxxxxx>
SECTION -- ext4_64k
RECREATING -- ext4 on /dev/loop0
FSTYP -- ext4
PLATFORM -- Linux/ppc64le localhost 6.17.0-rc2-00060-g068a56e56fa8
#2 SMP Thu Aug 21 16:28:18 IST 2025
MKFS_OPTIONS -- -F -b 65536 /dev/loop1
MOUNT_OPTIONS -- -o block_validity /dev/loop1 /mnt/scratch
generic/365 1s ... 1s
Ran: generic/365
Passed all 1 tests
---
tests/generic/365 | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/generic/365 b/tests/generic/365
index 36cb2530..bbadae71 100755
--- a/tests/generic/365
+++ b/tests/generic/365
@@ -32,6 +32,10 @@ if ((blksz < 2048)); then
_notrun "test requires at least 4 bblocks per fsblock"
fi
+# This makes sure there is free space surrounded by allocated blocks, which
+# is needed for some sub tests.
+$XFS_IO_PROG -fc 'falloc 0 3M' -c 'fpunch 1M 1M' -c 'fsync' $SCRATCH_MNT/f
+
$XFS_IO_PROG -c 'fsmap' $SCRATCH_MNT >> $seqres.full
find_freesp() {