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
80 -c 'pwrite -b 52k 0 52k' \
82 -c 'pread -b 200k 0 200k' \
83 $testfile | _filter_io
84 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
87 # on an odd byte boundary => 1 short of boundary
89 boundary_minus1=`expr 100 \* 1024 - 1`
90 echo "boundary_minus1 = $boundary_minus1"
92 -c 'pwrite -b 52k 0 52k' \
93 -c "truncate $boundary_minus1" \
94 -c 'pread -b 200k 0 200k' \
95 $testfile | _filter_io
96 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
99 # on an odd byte boundary => 1 over boundary
101 boundary_plus1=`expr 100 \* 1024 + 1`
102 echo "boundary_plus1 = $boundary_plus1"
104 -c 'pwrite -b 52k 0 52k' \
105 -c "truncate $boundary_plus1" \
106 -c 'pread -b 200k 0 200k' \
107 $testfile | _filter_io
108 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
112 _test_eof_unwritten_extent()
119 -c 'pwrite -b 52k 0 52k' \
120 -c 'pread -b 200k 0 200k' \
121 $testfile | _filter_io
122 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
125 # on an odd byte boundary => 1 short of boundary
127 boundary_minus1=`expr 100 \* 1024 - 1`
128 echo "boundary_minus1 = $boundary_minus1"
130 -c "resvsp 0 $boundary_minus1" \
131 -c "truncate $boundary_minus1" \
132 -c 'pwrite -b 52k 0 52k' \
133 -c 'pread -b 200k 0 200k' \
134 $testfile | _filter_io
135 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
138 # on an odd byte boundary => 1 over boundary
140 boundary_plus1=`expr 100 \* 1024 + 1`
141 echo "boundary_plus1 = $boundary_plus1"
143 -c "resvsp 0 $boundary_plus1" \
144 -c "truncate $boundary_plus1" \
145 -c 'pwrite -b 52k 0 52k' \
146 -c 'pread -b 200k 0 200k' \
147 $testfile | _filter_io
148 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
153 _test_eof_unwritten_extent