4 # Test concurrent pread/pwrite
6 # Copyright (C) 2014 Red Hat, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 owner
=kwolf@redhat.com
26 echo "QA output created by $seq"
28 status
=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
41 _supported_proto generic
50 echo "== Some concurrent requests involving RMW =="
54 echo "open -o driver=$IMGFMT,file.align=4k blkdebug::$TEST_IMG"
55 # A simple RMW request
57 aio_write -P 10 0x200 0x200
61 # Sequential RMW requests on the same physical sector
63 for ev
in "head" "after_head"; do
65 break pwritev_rmw_$ev A
66 aio_write -P 10 $((off + 0x200)) 0x200
68 aio_write -P 11 $((off + 0x400)) 0x200
76 # Chained dependencies
78 break pwritev_rmw_after_tail A
79 aio_write -P 10 0x5000 0x200
81 aio_write -P 11 0x5200 0x200
82 aio_write -P 12 0x5400 0x200
83 aio_write -P 13 0x5600 0x200
84 aio_write -P 14 0x5800 0x200
85 aio_write -P 15 0x5a00 0x200
86 aio_write -P 16 0x5c00 0x200
87 aio_write -P 17 0x5e00 0x200
93 # Overlapping multiple requests
95 break pwritev_rmw_after_tail A
96 aio_write -P 10 0x6000 0x200
98 break pwritev_rmw_after_head B
99 aio_write -P 10 0x7e00 0x200
101 aio_write -P 11 0x6800 0x1000
109 break pwritev_rmw_after_tail A
110 aio_write -P 10 0x8000 0x200
112 break pwritev_rmw_after_head B
113 aio_write -P 10 0x9e00 0x200
115 aio_write -P 11 0x8800 0x1000
123 break pwritev_rmw_after_tail A
124 aio_write -P 10 0xa000 0x200
126 aio_write -P 11 0xa800 0x1000
127 break pwritev_rmw_after_head B
128 aio_write -P 10 0xbe00 0x200
137 break pwritev_rmw_after_tail A
138 aio_write -P 10 0xc000 0x200
140 aio_write -P 11 0xc800 0x1000
141 break pwritev_rmw_after_head B
142 aio_write -P 10 0xde00 0x200
150 # Only RMW for the tail part
152 break pwritev_rmw_after_tail A
153 aio_write -P 10 0xe000 0x1800
155 aio_write -P 11 0xf000 0xc00
163 aio_write -P 10 0x10000 0x800
165 break pwritev_rmw_after_tail B
166 aio_write -P 11 0x10000 0x400
179 aio_write -P 10 0x11000 0x800
181 aio_write -P 11 0x11000 0x1000
188 test_io |
$QEMU_IO | _filter_qemu_io | \
189 sed -e 's,[0-9/]* bytes at offset [0-9]*,XXX/XXX bytes at offset XXX,g' \
190 -e 's/^[0-9]* \(bytes\|KiB\)/XXX bytes/' \
192 -e '/blkdebug: Resuming request/d'
195 echo "== Verify image content =="
199 # A simple RMW request
200 echo read -P 0 0 0x200
201 echo read -P 10 0x200 0x200
202 echo read -P 0 0x400 0xc00
204 # Sequential RMW requests on the same physical sector
205 echo read -P 0 0x1000 0x200
206 echo read -P 10 0x1200 0x200
207 echo read -P 11 0x1400 0x200
208 echo read -P 0 0x1600 0xa00
210 echo read -P 0 0x2000 0x200
211 echo read -P 10 0x2200 0x200
212 echo read -P 11 0x2400 0x200
213 echo read -P 0 0x2600 0xa00
215 # Chained dependencies
216 echo read -P 10 0x5000 0x200
217 echo read -P 11 0x5200 0x200
218 echo read -P 12 0x5400 0x200
219 echo read -P 13 0x5600 0x200
220 echo read -P 14 0x5800 0x200
221 echo read -P 15 0x5a00 0x200
222 echo read -P 16 0x5c00 0x200
223 echo read -P 17 0x5e00 0x200
225 # Overlapping multiple requests
226 echo read -P 10 0x6000 0x200
227 echo read -P 0 0x6200 0x600
228 echo read -P 11 0x6800 0x1000
229 echo read -P 0 0x7800 0x600
230 echo read -P 10 0x7e00 0x200
232 echo read -P 10 0x8000 0x200
233 echo read -P 0 0x8200 0x600
234 echo read -P 11 0x8800 0x1000
235 echo read -P 0 0x9800 0x600
236 echo read -P 10 0x9e00 0x200
238 echo read -P 10 0xa000 0x200
239 echo read -P 0 0xa200 0x600
240 echo read -P 11 0xa800 0x1000
241 echo read -P 0 0xb800 0x600
242 echo read -P 10 0xbe00 0x200
244 echo read -P 10 0xc000 0x200
245 echo read -P 0 0xc200 0x600
246 echo read -P 11 0xc800 0x1000
247 echo read -P 0 0xd800 0x600
248 echo read -P 10 0xde00 0x200
250 # Only RMW for the tail part
251 echo read -P 10 0xe000 0x1000
252 echo read -P 11 0xf800 0x400
253 echo read -P 0 0xfc00 0x400
255 echo read -P 11 0x10000 0x400
256 echo read -P 10 0x10400 0x400
258 echo read -P 11 0x11800 0x800
261 verify_io |
$QEMU_IO "$TEST_IMG" | _filter_qemu_io