qemu-iotests: Test one more spot for optimizing write_zeroes
Add another test to 154, showing that we currently allocate a data cluster in the top layer if any sector of the backing file was allocated. The next patch will optimize this case. Signed-off-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
5a64e94251
commit
31ad4fdf91
@ -114,6 +114,46 @@ $QEMU_IO -c "read -P 0 40k 3k" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
|
||||
|
||||
echo
|
||||
echo == write_zeroes covers non-zero data ==
|
||||
|
||||
CLUSTER_SIZE=512 TEST_IMG="$TEST_IMG.base" _make_test_img $size
|
||||
_make_test_img -b "$TEST_IMG.base"
|
||||
|
||||
# non-zero data at front of request
|
||||
# Backing file: -- XX -- --
|
||||
# Active layer: -- 00 00 --
|
||||
|
||||
$QEMU_IO -c "write -P 0x11 5k 1k" "$TEST_IMG.base" | _filter_qemu_io
|
||||
$QEMU_IO -c "write -z 5k 2k" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO -c "read -P 0 4k 4k" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
# non-zero data at end of request
|
||||
# Backing file: -- -- XX --
|
||||
# Active layer: -- 00 00 --
|
||||
|
||||
$QEMU_IO -c "write -P 0x11 14k 1k" "$TEST_IMG.base" | _filter_qemu_io
|
||||
$QEMU_IO -c "write -z 13k 2k" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO -c "read -P 0 12k 4k" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
# non-zero data matches size of request
|
||||
# Backing file: -- XX XX --
|
||||
# Active layer: -- 00 00 --
|
||||
|
||||
$QEMU_IO -c "write -P 0x11 21k 2k" "$TEST_IMG.base" | _filter_qemu_io
|
||||
$QEMU_IO -c "write -z 21k 2k" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO -c "read -P 0 20k 4k" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
# non-zero data smaller than request
|
||||
# Backing file: -- -X X- --
|
||||
# Active layer: -- 00 00 --
|
||||
|
||||
$QEMU_IO -c "write -P 0x11 30208 1k" "$TEST_IMG.base" | _filter_qemu_io
|
||||
$QEMU_IO -c "write -z 29k 2k" "$TEST_IMG" | _filter_qemu_io
|
||||
$QEMU_IO -c "read -P 0 28k 4k" "$TEST_IMG" | _filter_qemu_io
|
||||
|
||||
$QEMU_IMG map --output=json "$TEST_IMG" | _filter_qemu_img_map
|
||||
|
||||
echo
|
||||
echo == spanning two clusters, non-zero before request ==
|
||||
|
||||
|
@ -74,6 +74,43 @@ read 3072/3072 bytes at offset 40960
|
||||
{ "start": 40960, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 24576},
|
||||
{ "start": 45056, "length": 134172672, "depth": 1, "zero": true, "data": false}]
|
||||
|
||||
== write_zeroes covers non-zero data ==
|
||||
Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base
|
||||
wrote 1024/1024 bytes at offset 5120
|
||||
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
wrote 2048/2048 bytes at offset 5120
|
||||
2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
read 4096/4096 bytes at offset 4096
|
||||
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
wrote 1024/1024 bytes at offset 14336
|
||||
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
wrote 2048/2048 bytes at offset 13312
|
||||
2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
read 4096/4096 bytes at offset 12288
|
||||
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
wrote 2048/2048 bytes at offset 21504
|
||||
2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
wrote 2048/2048 bytes at offset 21504
|
||||
2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
read 4096/4096 bytes at offset 20480
|
||||
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
wrote 1024/1024 bytes at offset 30208
|
||||
1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
wrote 2048/2048 bytes at offset 29696
|
||||
2 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
read 4096/4096 bytes at offset 28672
|
||||
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
||||
[{ "start": 0, "length": 4096, "depth": 1, "zero": true, "data": false},
|
||||
{ "start": 4096, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 20480},
|
||||
{ "start": 8192, "length": 4096, "depth": 1, "zero": true, "data": false},
|
||||
{ "start": 12288, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 24576},
|
||||
{ "start": 16384, "length": 4096, "depth": 1, "zero": true, "data": false},
|
||||
{ "start": 20480, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 28672},
|
||||
{ "start": 24576, "length": 4096, "depth": 1, "zero": true, "data": false},
|
||||
{ "start": 28672, "length": 4096, "depth": 0, "zero": false, "data": true, "offset": 32768},
|
||||
{ "start": 32768, "length": 134184960, "depth": 1, "zero": true, "data": false}]
|
||||
|
||||
== spanning two clusters, non-zero before request ==
|
||||
Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=134217728
|
||||
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/t.IMGFMT.base
|
||||
|
Loading…
Reference in New Issue
Block a user