2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Calvin Owens. All Rights Reserved.
7 # Verify fallocate(mode=FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE) does
8 # not alter the file size.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
29 # remove previous $seqres.full before test
32 # real QA test starts here
34 # Modify as appropriate.
38 _require_xfs_io_command fpunch
40 testfile="${TEST_DIR}/testfile.$seq"
42 echo "Testing fallocate(mode=FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE)"
43 $XFS_IO_PROG -f -t -c "pwrite -b 2048 0 2048" $testfile | head -n1
44 # fpunch from xfs_io has KEEP_SIZE flag set
45 $XFS_IO_PROG -c "fpunch 2048 2048" $testfile
46 $XFS_IO_PROG -c "stat" $testfile | grep -F 'stat.size'