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
32 _require_xfs_io_command "fpunch"
34 echo "Create and format"
35 dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1")
36 _pwrite_byte 0x62 0 4m $dev >> $seqres.full
39 $XFS_IO_PROG -c "fpunch 512k 1m" $dev
41 echo "Punch range past EOD"
42 $XFS_IO_PROG -c "fpunch 3m 4m" $dev
45 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
47 echo "Punch to MAX_LFS_FILESIZE"
48 # zod = MAX_LFS_FILESIZE
49 zod=$(_get_max_lfs_filesize)
50 $XFS_IO_PROG -c "fpunch 0 $zod" $dev
53 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"