xfs/007: fix regressions on V4 filesystems
[xfstests-dev.git] / tests / xfs / 147
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2021 Oracle.  All Rights Reserved.
4 #
5 # FS QA Test No. 147
6 #
7 # Make sure we validate realtime extent size alignment for fallocate modes.
8 # This is a regression test for fe341eb151ec ("xfs: ensure that fpunch,
9 # fcollapse, and finsert operations are aligned to rt extent size")
10
11 . ./common/preamble
12 _begin_fstest auto quick rw realtime collapse insert unshare zero prealloc
13
14 # Import common functions.
15 . ./common/filter
16
17 # real QA test starts here
18 _supported_fs xfs
19 _require_scratch
20 _require_realtime
21 _require_xfs_io_command "fcollapse"
22 _require_xfs_io_command "finsert"
23 _require_xfs_io_command "funshare"
24 _require_xfs_io_command "fzero"
25 _require_xfs_io_command "falloc"
26
27 # Format filesystem with a 256k realtime extent size
28 _scratch_mkfs -r extsize=256k > $seqres.full
29 _scratch_mount >> $seqres.full
30
31 blksz=$(_get_block_size $SCRATCH_MNT)
32 rextsize=$($XFS_INFO_PROG $SCRATCH_MNT | grep realtime.*extsz | sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g')
33 rextblks=$((rextsize / blksz))
34
35 echo "blksz $blksz rextsize $rextsize rextblks $rextblks" >> $seqres.full
36
37 # Make sure the root directory has rtinherit set so our test file will too
38 _xfs_force_bdev realtime $SCRATCH_MNT
39
40 sz=$((rextsize * 100))
41 range="$((blksz * 3)) $blksz"
42
43 for verb in fpunch finsert fcollapse fzero funshare falloc; do
44         echo "test $verb"
45         $XFS_IO_PROG -f -c "falloc 0 $sz" "$SCRATCH_MNT/b"
46         $XFS_IO_PROG -f -c "$verb $range" "$SCRATCH_MNT/b"
47         rm -f "$SCRATCH_MNT/b"
48         _scratch_cycle_mount
49 done
50
51 # success, all done
52 status=0
53 exit