2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2007 Silicon Graphics, Inc. All Rights Reserved.
7 # To test for short dio reads on IRIX and Linux - pv#962005/962547
8 # http://bugworks.engr.sgi.com/query.cgi/962005
10 # In particular we are interested in dio_reads for the cases of:
12 # * eof on an unwritten extent
13 # * eof on a sector boundary and not on a sector boundary
16 seqres=$RESULT_DIR/$seq
17 echo "QA output created by $seq"
21 status=1 # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
32 tee -a $seqres.full | sed 's/ops;.*/ops/'
36 # 1: [128..199]: 212280..212351 0 (212280..212351) 72 10000
40 awk '$3 ~ /hole/ { print $1, $2, $3; next }
41 $7 ~ /10000/ { print $1, $2, "unwritten"; next }
42 {print $1, $2}' >> $seqres.full
45 # get standard environment, filters and checks
49 # real QA test starts here
51 # Modify as appropriate.
54 _require_xfs_io_command "falloc"
56 testfile=$TEST_DIR/file.$seq
64 -c 'pwrite -b 52k 0 52k' \
66 -c 'pread -b 200k 0 200k' \
67 $testfile | _filter_io
68 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
71 # on an odd byte boundary => 1 short of boundary
73 boundary_minus1=`expr 100 \* 1024 - 1`
74 echo "boundary_minus1 = $boundary_minus1"
76 -c 'pwrite -b 52k 0 52k' \
77 -c "truncate $boundary_minus1" \
78 -c 'pread -b 200k 0 200k' \
79 $testfile | _filter_io
80 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
83 # on an odd byte boundary => 1 over boundary
85 boundary_plus1=`expr 100 \* 1024 + 1`
86 echo "boundary_plus1 = $boundary_plus1"
88 -c 'pwrite -b 52k 0 52k' \
89 -c "truncate $boundary_plus1" \
90 -c 'pread -b 200k 0 200k' \
91 $testfile | _filter_io
92 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
96 _test_eof_unwritten_extent()
103 -c 'pwrite -b 52k 0 52k' \
104 -c 'pread -b 200k 0 200k' \
105 $testfile | _filter_io
106 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
109 # on an odd byte boundary => 1 short of boundary
111 boundary_minus1=`expr 100 \* 1024 - 1`
112 echo "boundary_minus1 = $boundary_minus1"
114 -c "resvsp 0 $boundary_minus1" \
115 -c "truncate $boundary_minus1" \
116 -c 'pwrite -b 52k 0 52k' \
117 -c 'pread -b 200k 0 200k' \
118 $testfile | _filter_io
119 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
122 # on an odd byte boundary => 1 over boundary
124 boundary_plus1=`expr 100 \* 1024 + 1`
125 echo "boundary_plus1 = $boundary_plus1"
127 -c "resvsp 0 $boundary_plus1" \
128 -c "truncate $boundary_plus1" \
129 -c 'pwrite -b 52k 0 52k' \
130 -c 'pread -b 200k 0 200k' \
131 $testfile | _filter_io
132 $XFS_IO_PROG -c 'bmap -vp' $testfile | _filter_bmap
137 _test_eof_unwritten_extent