Lines Matching +full:0 +full:- +full:64

25 seq="$(basename $0)"
34 trap "_cleanup; exit \$status" 0 1 2 3 15
48 # This tests qcow2-specific low-level functionality
57 # The repair process will create a large file - so check for availability first
58 _require_large_file 64G
60 rt_offset=65536 # 0x10000 (XXX: just an assumption)
61 rb_offset=131072 # 0x20000 (XXX: just an assumption)
62 l1_offset=196608 # 0x30000 (XXX: just an assumption)
63 l2_offset=262144 # 0x40000 (XXX: just an assumption)
64 l2_offset_after_snapshot=524288 # 0x80000 (XXX: just an assumption)
66 OPEN_RW="open -o overlap-check=all $TEST_IMG"
68 # image read-only makes the overlap-check option irrelevant
69 OPEN_RO="open -r $TEST_IMG"
74 _make_test_img 64M
76 # (Note the MSb in the L1 entry is set, ensuring the refcount is one - else any
86 $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
91 # This information should be available through qemu-img info
92 _img_info --format-specific
95 $QEMU_IO -c "$OPEN_RW" -c "read 0 512" 2>&1 | _filter_qemu_io \
100 $QEMU_IO -c "$OPEN_RO" -c "read 0 512" | _filter_qemu_io
108 _make_test_img 64M
110 truncate -s "$(($l2_offset+65536))" "$TEST_IMG"
118 $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
122 _check_test_img -r all
128 $QEMU_IO -c "$OPEN_RW" -c "write -P 0x2a 0 512" | _filter_qemu_io
134 _make_test_img 64M
135 $QEMU_IO -c "$OPEN_RW" -c "write -P 1 0 512" | _filter_qemu_io
136 $QEMU_IMG snapshot -c foo "$TEST_IMG"
137 $QEMU_IO -c "$OPEN_RW" -c "write -P 2 0 512" | _filter_qemu_io
143 $QEMU_IO -c "$OPEN_RW" -c "write -P 3 0 512" | _filter_qemu_io
145 _check_test_img -r all
147 $QEMU_IO -c "$OPEN_RW" -c "write -P 4 0 512" | _filter_qemu_io
151 $QEMU_IO -c "$OPEN_RO" -c "read -P 4 0 512" | _filter_qemu_io
152 $QEMU_IMG snapshot -a foo "$TEST_IMG"
154 $QEMU_IO -c "$OPEN_RO" -c "read -P 1 0 512" | _filter_qemu_io
162 $QEMU_IO -c 'write 0k 64k' "$BACKING_IMG" | _filter_qemu_io
164 _make_test_img -b "$BACKING_IMG" -F $IMGFMT 1G
167 $QEMU_IO -c 'write 0k 64k' -c 'write 512M 64k' "$TEST_IMG" | _filter_qemu_io
178 echo "open -o file.driver=blkdebug $TEST_IMG
179 break cow_read 0
180 aio_write 0k 1k
181 wait_break 0
182 write 64k 64k
183 resume 0" | $QEMU_IO | _filter_qemu_io
188 _make_test_img 64M
190 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
192 $QEMU_IO -c "write 64k 64k" "$TEST_IMG" | _filter_qemu_io
197 _make_test_img 64M
198 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
199 # This will be masked with ~(512 - 1) = ~0x1ff, so whether the lower 9 bits are
202 $QEMU_IO -c "read 0 64k" "$TEST_IMG" | _filter_qemu_io
205 _make_test_img 64M
206 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
208 $QEMU_IMG amend -o compat=0.10 "$TEST_IMG"
213 _make_test_img 64M
214 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
216 $QEMU_IO -c "read 0 64k" "$TEST_IMG" | _filter_qemu_io
219 echo "=== Testing unaligned pre-allocated zero cluster ==="
221 _make_test_img 64M
222 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
225 $QEMU_IMG amend -o compat=0.10 "$TEST_IMG"
230 _make_test_img 64M
232 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
235 echo "=== Testing non-fatal corruption on freeing ==="
237 _make_test_img 64M
238 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
240 $QEMU_IO -c "discard 0 64k" "$TEST_IMG" | _filter_qemu_io
243 echo "=== Testing read-only corruption report ==="
245 _make_test_img 64M
246 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
249 $QEMU_IO -c "$OPEN_RO" -c "read 0 64k" -c "read 0 64k" | _filter_qemu_io
252 echo "=== Testing non-fatal and then fatal corruption report ==="
254 _make_test_img 64M
255 $QEMU_IO -c "write 0 128k" "$TEST_IMG" | _filter_qemu_io
259 $QEMU_IO -c "discard 0 64k" -c "read 64k 64k" "$TEST_IMG" | _filter_qemu_io
264 _make_test_img 64M
266 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
268 _check_test_img -r all
273 _make_test_img 64M
274 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
278 # causing a refcount block to be allocated at offset 0
279 $QEMU_IO -c "write 0 128k" "$TEST_IMG" | _filter_qemu_io
281 _check_test_img -r all
286 _make_test_img 64M
288 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
290 _check_test_img -r all
295 _make_test_img 64M
296 $QEMU_IO -c "write 64k 64k" "$TEST_IMG" | _filter_qemu_io
299 # write will try to allocate a compressed data cluster at offset 0.
300 $QEMU_IO -c "write -c 0k 64k" "$TEST_IMG" | _filter_qemu_io
302 _check_test_img -r all
307 _make_test_img 64M
309 $QEMU_IO -c "write 0 64k" "$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt
311 _check_test_img -r all
316 _make_test_img 64M
318 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
324 _make_test_img 64M
329 $PYTHON qcow2.py "$TEST_IMG" set-feature-bit incompatible 0
331 $QEMU_IO -c close "$TEST_IMG" 2>&1 | _filter_testdir | _filter_imgfmt
333 echo '--- Repairing ---'
338 _check_test_img -r all
344 _make_test_img 64M
347 $QEMU_IO -c "write 0 64k" -c "discard 0 64k" "$TEST_IMG" | _filter_qemu_io
352 $QEMU_IO -c "write 0 64k" "$TEST_IMG" | _filter_qemu_io
354 echo '--- Repairing ---'
355 _check_test_img -r all
361 _make_test_img 64M
363 $QEMU_IO -c "write 0 128k" "$TEST_IMG" | _filter_qemu_io
368 $QEMU_IO -c "discard 0 65537" "$TEST_IMG"
370 echo '--- Repairing ---'
372 # function from double-checking
373 # (Using -q for the first invocation, because otherwise the
374 # double-check error message appears above the summary for some
375 # reason -- so let's just hide the summary)
376 _check_test_img -q -r all
377 _check_test_img -r all
380 echo "=== Discarding an out-of-bounds refblock ==="
383 _make_test_img 64M
389 $QEMU_IMG resize --shrink "$TEST_IMG" 32M
391 echo '--- Checking and retrying ---'
396 _check_test_img -r all
398 $QEMU_IMG resize --shrink "$TEST_IMG" 32M
402 echo "=== Discarding a non-covered in-bounds refblock ==="
405 _make_test_img -o 'refcount_bits=1' 64M
411 # to 0x10_0000_0000 (64G) to point to the third refblock
413 $QEMU_IMG resize --shrink "$TEST_IMG" 32M
415 echo '--- Checking and retrying ---'
420 _check_test_img -r all
422 $QEMU_IMG resize --shrink "$TEST_IMG" 32M
429 _make_test_img -o 'refcount_bits=1' 64M
435 $QEMU_IMG resize --shrink "$TEST_IMG" 32M
437 echo '--- Repairing ---'
439 # function from double-checking
440 # (Using -q for the first invocation, because otherwise the
441 # double-check error message appears above the summary for some
442 # reason -- so let's just hide the summary)
443 _check_test_img -q -r all
444 _check_test_img -r all
449 _make_test_img 64M
452 {'execute': 'human-monitor-command',
453 'arguments': {'command-line': 'qemu-io drive \"write 0 512\"'}}
455 | $QEMU -qmp stdio -nographic -nodefaults \
456 -drive if=none,node-name=drive,file="$TEST_IMG",driver=qcow2 \
463 _make_test_img 64M
468 # Inactive images are effectively read-only images, so this should be a
469 # non-fatal corruption (which does not modify the image)
471 {'execute': 'human-monitor-command',
472 'arguments': {'command-line': 'qemu-io drive \"read 0 512\"'}}
474 | $QEMU -qmp stdio -nographic -nodefaults \
475 -blockdev "{'node-name': 'drive',
481 -incoming exec:'cat /dev/null' \
487 _img_info --format-specific | grep 'corrupt:'
491 rm -f $seq.full
492 status=0