4 # Test the unsupported fallocate flags on a block device. No collapse
5 # or insert range, no regular fallocate, no forgetting keep-space on
6 # zero range, no punching past EOD, no requests that aren't aligned
7 # with the logicalsector size, and make sure the fallbacks work for
8 # devices that don't support write_same or discard.
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2016 Oracle, Inc. All Rights Reserved.
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #-----------------------------------------------------------------------
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 7 15
43 # get standard environment, filters and checks
48 # real QA test starts here
51 _require_xfs_io_command "falloc"
52 _require_xfs_io_command "finsert"
53 _require_xfs_io_command "fcollapse"
54 _require_xfs_io_command "fzero"
55 _require_xfs_io_command "fpunch"
58 echo "Create and format"
59 dev=$(_get_scsi_debug_dev 4096 4096 0 4 "lbpws=1 lbpws10=1")
60 _pwrite_byte 0x62 0 4m $dev >> $seqres.full
61 $XFS_IO_PROG -c "fsync" $dev
63 echo "Regular fallocate"
64 $XFS_IO_PROG -c "falloc 64k 64k" $dev
67 $XFS_IO_PROG -c "finsert 128k 64k" $dev
70 $XFS_IO_PROG -c "fcollapse 256k 64k" $dev
72 echo "Unaligned zero range"
73 $XFS_IO_PROG -c "fzero -k 512 512" $dev
75 echo "Unaligned punch"
76 $XFS_IO_PROG -c "fpunch 512 512" $dev
78 echo "Zero range past MAX_LFS_FILESIZE keep size"
79 # zod = MAX_LFS_FILESIZE
80 case "$(getconf LONG_BIT)" in
82 zod=$(( ($(getconf PAGE_SIZE) << ($(getconf LONG_BIT) - 1) ) - 1))
85 zod=9223372036854775807
88 _fail "sizeof(long) == $(getconf LONG_BIT)?"
91 $XFS_IO_PROG -c "fzero -k 512k $zod" $dev
93 echo "Zero range past MAX_LFS_FILESIZE"
94 $XFS_IO_PROG -c "fzero 512k $zod" $dev
96 echo "Zero range to MAX_LFS_FILESIZE fail w/o keepsize"
97 $XFS_IO_PROG -c "fzero 0 $zod" $dev
99 echo "Zero range starts past EOD"
100 $XFS_IO_PROG -c "fzero -k 900m 1m" $dev
102 echo "Punch starts past EOD"
103 $XFS_IO_PROG -c "fpunch 900m 1m" $dev
105 echo "Check contents"
106 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
108 echo "Destroy device"
111 echo "Create w/o unmap or writesame and format"
112 dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=0 lbpws10=0 lbpu=0 write_same_length=0 unmap_max_blocks=0")
113 _pwrite_byte 0x62 0 4m $dev >> $seqres.full
114 $XFS_IO_PROG -c "fsync" $dev
116 echo "Zero punch, no fallback available"
117 $XFS_IO_PROG -c "fpunch 512k 512k" $dev
119 echo "Zero range, write fallback"
120 $XFS_IO_PROG -c "fzero -k 1536k 512k" $dev
122 echo "Check contents"
123 md5sum $dev | sed -e "s|$dev|SCSI_DEBUG_DEV|g"
125 echo "Destroy device"