4 # To test for short dio reads on IRIX and Linux - pv#962005/962547
5 # http://bugworks.engr.sgi.com/query.cgi/962005
7 # In particular we are interested in dio_reads for the cases of:
9 # * eof on an unwritten extent
10 # * eof on a sector boundary and not on a sector boundary
12 #-----------------------------------------------------------------------
13 # Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
15 # This program is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation.
19 # This program is distributed in the hope that it would be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write the Free Software Foundation,
26 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #-----------------------------------------------------------------------
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
37 status=1 # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
48 tee -a $seqres.full | sed 's/ops;.*/ops/'
52 # 1: [128..199]: 212280..212351 0 (212280..212351) 72 10000
56 awk '$3 ~ /hole/ { print $1, $2, $3; next }
57 $7 ~ /10000/ { print $1, $2, "unwritten"; next }
58 {print $1, $2}' >> $seqres.full
61 # get standard environment, filters and checks
65 # real QA test starts here
67 # Modify as appropriate.
69 _supported_os IRIX Linux
72 testfile=$TEST_DIR/file.$seq
79 -c 'pwrite -b 52k 0 52k' \
81 -c 'pread -b 200k 0 200k' \
82 $testfile | _filter_io
83 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
86 # on an odd byte boundary => 1 short of boundary
88 boundary_minus1=`expr 100 \* 1024 - 1`
89 echo "boundary_minus1 = $boundary_minus1"
91 -c 'pwrite -b 52k 0 52k' \
92 -c "truncate $boundary_minus1" \
93 -c 'pread -b 200k 0 200k' \
94 $testfile | _filter_io
95 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
98 # on an odd byte boundary => 1 over boundary
100 boundary_plus1=`expr 100 \* 1024 + 1`
101 echo "boundary_plus1 = $boundary_plus1"
103 -c 'pwrite -b 52k 0 52k' \
104 -c "truncate $boundary_plus1" \
105 -c 'pread -b 200k 0 200k' \
106 $testfile | _filter_io
107 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
111 _test_eof_unwritten_extent()
118 -c 'pwrite -b 52k 0 52k' \
119 -c 'pread -b 200k 0 200k' \
120 $testfile | _filter_io
121 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
124 # on an odd byte boundary => 1 short of boundary
126 boundary_minus1=`expr 100 \* 1024 - 1`
127 echo "boundary_minus1 = $boundary_minus1"
129 -c "resvsp 0 $boundary_minus1" \
130 -c "truncate $boundary_minus1" \
131 -c 'pwrite -b 52k 0 52k' \
132 -c 'pread -b 200k 0 200k' \
133 $testfile | _filter_io
134 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
137 # on an odd byte boundary => 1 over boundary
139 boundary_plus1=`expr 100 \* 1024 + 1`
140 echo "boundary_plus1 = $boundary_plus1"
142 -c "resvsp 0 $boundary_plus1" \
143 -c "truncate $boundary_plus1" \
144 -c 'pwrite -b 52k 0 52k' \
145 -c 'pread -b 200k 0 200k' \
146 $testfile | _filter_io
147 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
152 _test_eof_unwritten_extent