summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2014-02-08 14:38:33 +0100
committerKevin Wolf <kwolf@redhat.com>2014-02-21 21:02:21 +0100
commita71835a0ccff168b19ffc9656fe27988821ec59a (patch)
tree9d328538c78f9be36db90eb4dff9c8d4b3de2e77 /tests
parent3e890c77cf038d8c2de66ed7996fe77a6f94787c (diff)
downloadqemu-a71835a0ccff168b19ffc9656fe27988821ec59a.tar.gz
qcow2: Set zero flag for discarded clusters
Instead of making the backing file contents visible again after a discard request, set the zero flag if possible (i.e. on version >= 3). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/04618
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
index 2d44bbb187..e0be46cf2b 100755
--- a/tests/qemu-iotests/046
+++ b/tests/qemu-iotests/046
@@ -193,6 +193,16 @@ echo "== Verify image content =="
function verify_io()
{
+ if ($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep "compat: 0.10" > /dev/null); then
+ # For v2 images, discarded clusters are read from the backing file
+ # Keep the variable empty so that the backing file value can be used as
+ # the default below
+ discarded=
+ else
+ # Discarded clusters are zeroed for v3 or later
+ discarded=0
+ fi
+
echo read -P 0 0 0x10000
echo read -P 1 0x10000 0x2000
@@ -221,16 +231,16 @@ function verify_io()
echo read -P 70 0x78000 0x6000
echo read -P 7 0x7e000 0x2000
- echo read -P 8 0x80000 0x6000
+ echo read -P ${discarded:-8} 0x80000 0x6000
echo read -P 80 0x86000 0x2000
- echo read -P 8 0x88000 0x2000
+ echo read -P ${discarded:-8} 0x88000 0x2000
echo read -P 81 0x8a000 0xe000
echo read -P 90 0x98000 0x6000
echo read -P 9 0x9e000 0x2000
- echo read -P 10 0xa0000 0x6000
+ echo read -P ${discarded:-10} 0xa0000 0x6000
echo read -P 100 0xa6000 0x2000
- echo read -P 10 0xa8000 0x2000
+ echo read -P ${discarded:-10} 0xa8000 0x2000
echo read -P 101 0xaa000 0xe000
echo read -P 110 0xb8000 0x8000