2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2021 Oracle. All Rights Reserved.
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")
12 _begin_fstest auto quick rw realtime collapse insert unshare zero prealloc
14 # Import common functions.
17 # real QA test starts here
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"
27 # Format filesystem with a 256k realtime extent size
28 _scratch_mkfs -r extsize=256k > $seqres.full
29 _scratch_mount >> $seqres.full
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))
35 echo "blksz $blksz rextsize $rextsize rextblks $rextblks" >> $seqres.full
37 # Make sure the root directory has rtinherit set so our test file will too
38 _xfs_force_bdev realtime $SCRATCH_MNT
40 sz=$((rextsize * 100))
41 range="$((blksz * 3)) $blksz"
43 for verb in fpunch finsert fcollapse fzero funshare falloc; do
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"