qcow2: Force preallocation with data-file-raw
commit484108293d94d80acd5a2f4332eaea5e2605947a
authorMax Reitz <mreitz@redhat.com>
Fri, 26 Mar 2021 14:55:08 +0000 (26 15:55 +0100)
committerMax Reitz <mreitz@redhat.com>
Tue, 30 Mar 2021 11:02:10 +0000 (30 13:02 +0200)
treeb7027cc72f7680b4d68d40f0eaccd4afa18cc6b0
parent220222a0fecf0fbd9f49633abef552dd019ab9cd
qcow2: Force preallocation with data-file-raw

Setting the qcow2 data-file-raw bit means that you can ignore the
qcow2 metadata when reading from the external data file.  It does not
mean that you have to ignore it, though.  Therefore, the data read must
be the same regardless of whether you interpret the metadata or whether
you ignore it, and thus the L1/L2 tables must all be present and give a
1:1 mapping.

This patch changes 244's output: First, the qcow2 file is larger right
after creation, because of metadata preallocation.  Second, the qemu-img
map output changes: Everything that was not explicitly discarded or
zeroed is now a data area.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210326145509.163455-2-mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
block/qcow2.c
tests/qemu-iotests/244.out