Lines Matching +full:read +full:- +full:1
28 status=1 # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
55 _make_test_img -o "data_file=$TEST_IMG.data" 64M
58 $QEMU_IO -c "open $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filter_qemu_io | _filter_testdir
59 $QEMU_IO -c "open -odata-file.filename=$TEST_IMG.data $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filte…
60 $QEMU_IO -c "open -odata-file.filename=inexistent $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filter_qe…
64 $QEMU_IMG amend -odata_file= $TEST_IMG
66 $QEMU_IO -c "open $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filter_qemu_io | _filter_testdir
67 $QEMU_IO -c "open -odata-file.filename=$TEST_IMG.data $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filte…
68 $QEMU_IO -c "open -odata-file.filename=inexistent $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filter_qe…
71 echo "Setting data-file for an image with internal data:"
74 $QEMU_IO -c "open -odata-file.filename=$TEST_IMG.data $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filte…
75 $QEMU_IO -c "open -odata-file.filename=inexistent $TEST_IMG" -c "read -P 0 0 64k" 2>&1 | _filter_qe…
84 $QEMU_IO -c 'write -P 0x11 0 1M' \
85 -f $IMGFMT "$TEST_IMG.src" |
88 $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -c -odata_file="$TEST_IMG.data" \
93 $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -odata_file="$TEST_IMG.data" \
97 $QEMU_IO -c 'write -c -P 0x22 0 1M' \
98 -f $IMGFMT "$TEST_IMG" |
105 $QEMU_IMG snapshot -c test "$TEST_IMG"
112 _make_test_img -o "data_file=$TEST_IMG.data" 64M
114 echo -n "qcow2 file size before I/O: "
115 du -b $TEST_IMG | cut -f1
118 # 0-1 MB: Unallocated
119 # 1-2 MB: Written (pattern 0x11)
120 # 2-3 MB: Discarded
121 # 3-4 MB: Zero write over discarded space
122 # 4-5 MB: Zero write over written space
123 # 5-6 MB: Zero write over unallocated space
126 $QEMU_IO -c 'write -P 0x11 1M 4M' \
127 -c 'discard 2M 2M' \
128 -c 'write -z 3M 3M' \
129 -f $IMGFMT "$TEST_IMG" |
134 $QEMU_IMG map --output=json "$TEST_IMG"
137 $QEMU_IO -c 'read -P 0 0 1M' \
138 -c 'read -P 0x11 1M 1M' \
139 -c 'read -P 0 2M 4M' \
140 -f $IMGFMT "$TEST_IMG" |
146 $QEMU_IO -c 'read -P 0 0 1M' \
147 -c 'read -P 0x11 1M 1M' \
148 -c 'read -P 0x11 4M 1M' \
149 -c 'read -P 0 5M 1M' \
150 -f raw "$TEST_IMG.data" |
154 echo -n "qcow2 file size after I/O: "
155 du -b $TEST_IMG | cut -f1
161 _make_test_img -o "data_file=$TEST_IMG.data,data_file_raw=on" 64M
163 echo -n "qcow2 file size before I/O: "
164 du -b $TEST_IMG | cut -f1
167 $QEMU_IO -c 'write -P 0x11 1M 4M' \
168 -c 'discard 2M 2M' \
169 -c 'write -z 3M 3M' \
170 -f $IMGFMT "$TEST_IMG" |
175 $QEMU_IMG map --output=json "$TEST_IMG"
178 $QEMU_IO -c 'read -P 0 0 1M' \
179 -c 'read -P 0x11 1M 1M' \
180 -c 'read -P 0 2M 4M' \
181 -f $IMGFMT "$TEST_IMG" |
188 $QEMU_IO -c 'read -P 0 0 1M' \
189 -c 'read -P 0x11 1M 1M' \
190 -c 'read -P 0 3M 3M' \
191 -f raw "$TEST_IMG".data |
194 echo -n "qcow2 file size after I/O: "
195 du -b $TEST_IMG | cut -f1
201 _make_test_img -o "data_file=$TEST_IMG.data" 64M
203 $QEMU_IO -c 'write -P 0x11 0 1M' -f $IMGFMT "$TEST_IMG" | _filter_qemu_io
204 $QEMU_IO -c 'read -P 0x11 0 1M' -f $IMGFMT "$TEST_IMG" | _filter_qemu_io
205 $QEMU_IMG map --output=human "$TEST_IMG" | _filter_testdir
206 $QEMU_IMG map --output=json "$TEST_IMG"
213 _make_test_img -o "data_file=$TEST_IMG.data" 64M
214 $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n -C "$TEST_IMG.src" "$TEST_IMG"
215 $QEMU_IMG compare -f $IMGFMT -F $IMGFMT "$TEST_IMG.src" "$TEST_IMG"
224 'data-file': {
232 $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n -C "$TEST_IMG.src" "$test_img_with_blkdebug"
233 $QEMU_IMG compare -f $IMGFMT -F $IMGFMT "$TEST_IMG.src" "$test_img_with_blkdebug"
242 # flushed, we will see qemu-io return an error.
245 # also need -t writeback so the write is not done as a FUA write
247 $QEMU_IO -c 'write 0 512' -c flush \
248 -t writeback \
255 'data-file': {
257 'inject-error': [{
274 echo "ERROR: qemu-io succeeded, so the data file was not flushed"
276 1)
277 echo "Success: qemu-io failed, so the data file was flushed"
280 echo "ERROR: qemu-io returned unknown exit code $result"
285 echo '=== Preallocation with data-file-raw ==='
288 echo '--- Using a non-zeroed data file ---'
290 # Using data-file-raw must enforce at least metadata preallocation so
294 # Pre-create the data file, write some data. Real-world use cases for
296 # the device as the data file) or adding qcow2 features to pre-existing
298 truncate -s 1M "$TEST_IMG.data"
299 $QEMU_IO -f raw -c 'write -P 42 0 1M' "$TEST_IMG.data" | _filter_qemu_io
301 # We cannot use qemu-img to create the qcow2 image, because it would
302 # clear the data file. Use the blockdev-create job instead, which will
306 -blockdev file,node-name=data,filename="$TEST_IMG.data" \
307 -blockdev file,node-name=meta,filename="$TEST_IMG"
312 '{ "execute": "blockdev-create",
314 "job-id": "create",
317 "size": '"$((1 * 1024 * 1024))"',
319 "data-file": "data",
320 "data-file-raw": true
325 '{ "execute": "job-dismiss", "arguments": { "id": "create" } }' \
335 $QEMU_IO -f raw -c 'read -P 42 0 1M' "$TEST_IMG.data" | _filter_qemu_io
336 $QEMU_IO -f $IMGFMT -c 'read -P 42 0 1M' "$TEST_IMG" | _filter_qemu_io
339 $QEMU_IMG compare -f raw "$TEST_IMG.data" "$TEST_IMG"
342 echo '--- Truncation (growing) ---'
347 truncate -s 2M "$TEST_IMG.data"
348 $QEMU_IO -f raw -c 'write -P 84 1M 1M' "$TEST_IMG.data" | _filter_qemu_io
355 $QEMU_IO -f raw -c 'read -P 42 0 1M' -c 'read -P 84 1M 1M' "$TEST_IMG.data" \
357 $QEMU_IO -f $IMGFMT -c 'read -P 42 0 1M' -c 'read -P 84 1M 1M' "$TEST_IMG" \
360 $QEMU_IMG compare -f raw "$TEST_IMG.data" "$TEST_IMG"
363 echo '--- Giving a backing file at runtime ---'
365 # qcow2 files with data-file-raw cannot have backing files given by
367 # runtime -- it should not have any effect, though (because reading
371 _make_test_img -o "data_file=$TEST_IMG.data,data_file_raw=on" 1M
372 TEST_IMG="$TEST_IMG.base" _make_test_img 1M
375 $QEMU_IO -c 'write -P 42 0 1M' "$TEST_IMG.base" | _filter_qemu_io
383 $QEMU_IMG compare --image-opts \
389 rm -f $seq.full