]> Git Repo - qemu.git/commit
qcow2: Fix .bdrv_has_zero_init()
authorMax Reitz <[email protected]>
Wed, 24 Jul 2019 17:12:34 +0000 (19:12 +0200)
committerMax Reitz <[email protected]>
Mon, 19 Aug 2019 15:13:26 +0000 (17:13 +0200)
commit38841dcd27a41e2d8916b7cf4f508a5663f453ff
tree217862f70b3fed2b826bd4639c45db2b5c6b35e0
parentb647d69adc394312dedb56f6b3ce19b9c316931f
qcow2: Fix .bdrv_has_zero_init()

If a qcow2 file is preallocated, it can no longer guarantee that it
initially appears as filled with zeroes.

So implement .bdrv_has_zero_init() by checking whether the file is
preallocated; if so, forward the call to the underlying storage node,
except for when it is encrypted: Encrypted preallocated images always
return effectively random data, so .bdrv_has_zero_init() must always
return 0 for them.

.bdrv_has_zero_init_truncate() can remain bdrv_has_zero_init_1(),
because it presupposes PREALLOC_MODE_OFF.

Reported-by: Stefano Garzarella <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
Message-id: 20190724171239[email protected]
Reviewed-by: Maxim Levitsky <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
block/qcow2.c
This page took 0.025702 seconds and 4 git commands to generate.