#! /bin/bash # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2021 Oracle. All Rights Reserved. # # FS QA Test No. 147 # # Make sure we validate realtime extent size alignment for fallocate modes. # This is a regression test for fe341eb151ec ("xfs: ensure that fpunch, # fcollapse, and finsert operations are aligned to rt extent size") seq=`basename $0` seqres=$RESULT_DIR/$seq echo "QA output created by $seq" here=`pwd` tmp=/tmp/$$ status=1 # failure is the default! trap "_cleanup; exit \$status" 0 1 2 3 15 _cleanup() { cd / rm -f $tmp.* } # get standard environment, filters and checks . ./common/rc . ./common/filter # real QA test starts here _supported_fs xfs _require_scratch _require_realtime _require_xfs_io_command "fcollapse" _require_xfs_io_command "finsert" _require_xfs_io_command "funshare" _require_xfs_io_command "fzero" _require_xfs_io_command "falloc" rm -f $seqres.full # Format filesystem with a 256k realtime extent size _scratch_mkfs -r extsize=256k > $seqres.full _scratch_mount >> $seqres.full blksz=$(_get_block_size $SCRATCH_MNT) rextsize=$($XFS_INFO_PROG $SCRATCH_MNT | grep realtime.*extsz | sed -e 's/^.*extsz=\([0-9]*\).*$/\1/g') rextblks=$((rextsize / blksz)) echo "blksz $blksz rextsize $rextsize rextblks $rextblks" >> $seqres.full # Make sure the root directory has rtinherit set so our test file will too _xfs_force_bdev realtime $SCRATCH_MNT sz=$((rextsize * 100)) range="$((blksz * 3)) $blksz" for verb in fpunch finsert fcollapse fzero funshare falloc; do echo "test $verb" $XFS_IO_PROG -f -c "falloc 0 $sz" "$SCRATCH_MNT/b" $XFS_IO_PROG -f -c "$verb $range" "$SCRATCH_MNT/b" rm -f "$SCRATCH_MNT/b" _scratch_cycle_mount done # success, all done status=0 exit