diff options
author | Max Reitz <mreitz@redhat.com> | 2019-07-24 19:12:34 +0200 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2019-08-19 17:13:26 +0200 |
commit | 38841dcd27a41e2d8916b7cf4f508a5663f453ff (patch) | |
tree | 217862f70b3fed2b826bd4639c45db2b5c6b35e0 /block/vdi.c | |
parent | b647d69adc394312dedb56f6b3ce19b9c316931f (diff) |
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 <sgarzare@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190724171239.8764-7-mreitz@redhat.com
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/vdi.c')
0 files changed, 0 insertions, 0 deletions