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 _begin_fstest blockdev rw punch
13 _register_cleanup "_cleanup" BUS
15 # Import common functions.
19 # real QA test starts here
21 _require_xfs_io_command "fpunch"
23 echo "Create and format"
24 dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1")
25 _pwrite_byte 0x62 0 4m $dev >> $seqres.full
28 $XFS_IO_PROG -c "fpunch 512k 1m" $dev
30 echo "Punch range past EOD"
31 $XFS_IO_PROG -c "fpunch 3m 4m" $dev
34 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
36 echo "Punch to MAX_LFS_FILESIZE"
37 # zod = MAX_LFS_FILESIZE
38 zod=$(_get_max_lfs_filesize)
39 $XFS_IO_PROG -c "fpunch 0 $zod" $dev
42 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"