4 # Test fallocate(PUNCH_HOLE) on a block device, which should be able to
5 # zero-TRIM (or equivalent) the range.
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2016 Oracle, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 7 15
40 # get standard environment, filters and checks
45 # real QA test starts here
48 _require_xfs_io_command "fpunch"
50 echo "Create and format"
51 dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1")
52 _pwrite_byte 0x62 0 4m $dev >> $seqres.full
55 $XFS_IO_PROG -c "fpunch 512k 1m" $dev
57 echo "Punch range past EOD"
58 $XFS_IO_PROG -c "fpunch 3m 4m" $dev
61 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
63 echo "Punch to MAX_LFS_FILESIZE"
64 # zod = MAX_LFS_FILESIZE
65 case "$(getconf LONG_BIT)" in
67 zod=$(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
70 zod=9223372036854775807
73 _fail "sizeof(long) == $(getconf LONG_BIT)?"
76 $XFS_IO_PROG -c "fpunch 0 $zod" $dev
79 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"