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 _begin_fstest auto quick punch
13 # Import common functions.
16 # real QA test starts here
18 # Modify as appropriate.
21 _require_xfs_io_command fpunch
23 testfile="${TEST_DIR}/testfile.$seq"
25 echo "Testing fallocate(mode=FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE)"
26 $XFS_IO_PROG -f -t -c "pwrite -b 2048 0 2048" $testfile | head -n1
27 # fpunch from xfs_io has KEEP_SIZE flag set
28 $XFS_IO_PROG -c "fpunch 2048 2048" $testfile
29 $XFS_IO_PROG -c "stat" $testfile | grep -F 'stat.size'