2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Oracle, Inc. All Rights Reserved.
7 # Test fallocate(PUNCH_HOLE) on a block device, which should be able to
8 # zero-TRIM (or equivalent) the range.
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 7 15
25 # get standard environment, filters and checks
30 # real QA test starts here
33 _require_xfs_io_command "fpunch"
35 echo "Create and format"
36 dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1")
37 _pwrite_byte 0x62 0 4m $dev >> $seqres.full
40 $XFS_IO_PROG -c "fpunch 512k 1m" $dev
42 echo "Punch range past EOD"
43 $XFS_IO_PROG -c "fpunch 3m 4m" $dev
46 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
48 echo "Punch to MAX_LFS_FILESIZE"
49 # zod = MAX_LFS_FILESIZE
50 zod=$(_get_max_lfs_filesize)
51 $XFS_IO_PROG -c "fpunch 0 $zod" $dev
54 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"