From 8735e3e15fc7059cb35262003921cb498bb83153 Mon Sep 17 00:00:00 2001 From: Ojaswin Mujoo Date: Tue, 5 Aug 2025 14:55:56 +0530 Subject: [PATCH] generic/365: Fix false failure when mapping ends with free space 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 Tested-by: Disha Goel Reviewed-by: Zorro Lang Signed-off-by: Zorro Lang --- tests/generic/365 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/generic/365 b/tests/generic/365 index 36cb2530..4acc4b01 100755 --- a/tests/generic/365 +++ b/tests/generic/365 @@ -22,6 +22,8 @@ fi . ./common/filter _require_xfs_io_command "fsmap" +_require_xfs_io_command "falloc" +_require_xfs_io_command "fpunch" _require_scratch _scratch_mkfs >> $seqres.full @@ -32,6 +34,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() { -- 2.39.5