On 3/27/20 1:43 PM, Alberto Garcia wrote:
On Fri 27 Mar 2020 07:13:04 PM CET, Eric Blake wrote:
+for qcow2_compat in 0.10 1.1; do
+    echo "# Create an image with compat=$qcow2_compat without a backing file"
+    _make_test_img -o "compat=$qcow2_compat" 128k
+
+    echo "# Fill all clusters with data and then discard them"
+    $QEMU_IO -c 'write -P 0x01 0 128k' "$TEST_IMG" | _filter_qemu_io
+    $QEMU_IO -c 'discard 0 128k' "$TEST_IMG" | _filter_qemu_io
+
+    echo "# Read the data from the discarded clusters"
+    $QEMU_IO -c 'read -P 0x00 0 128k' "$TEST_IMG" | _filter_qemu_io
+done

Should this loop also inspect qemu-img map output?

I guess we can, although here the image is completely unallocated in
both cases.

Which shows that even for v2 images, discard DOES do something when there is no backing file (even if it is now a no-op when there is a backing file after this patch).

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


Reply via email to