Skip to content

Commit

Permalink
doc: Preallocation does not require writing zeroes
Browse files Browse the repository at this point in the history
When preallocating an encrypted qcow2 image, it just lets the protocol
driver write data and then does not mark the clusters as zero.
Therefore, reading this image will yield effectively random data.

As such, we have not fulfilled the promise of always writing zeroes when
preallocating an image in a while.  It seems that nobody has really
cared, so change the documentation to conform to qemu's actual behavior.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20190711132935.13070-1-mreitz@redhat.com
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
  • Loading branch information
XanClic committed Aug 19, 2019
1 parent 9c46f4a commit fa27c47
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/qemu-block-drivers.texi
Expand Up @@ -31,8 +31,8 @@ Supported options:
@item preallocation
Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}).
@code{falloc} mode preallocates space for image by calling posix_fallocate().
@code{full} mode preallocates space for image by writing zeros to underlying
storage.
@code{full} mode preallocates space for image by writing data to underlying
storage. This data may or may not be zero, depending on the storage location.
@end table

@item qcow2
Expand Down
9 changes: 5 additions & 4 deletions qapi/block-core.json
Expand Up @@ -5178,10 +5178,11 @@
# @off: no preallocation
# @metadata: preallocate only for metadata
# @falloc: like @full preallocation but allocate disk space by
# posix_fallocate() rather than writing zeros.
# @full: preallocate all data by writing zeros to device to ensure disk
# space is really available. @full preallocation also sets up
# metadata correctly.
# posix_fallocate() rather than writing data.
# @full: preallocate all data by writing it to the device to ensure
# disk space is really available. This data may or may not be
# zero, depending on the image format and storage.
# @full preallocation also sets up metadata correctly.
#
# Since: 2.2
##
Expand Down
4 changes: 2 additions & 2 deletions qemu-img.texi
Expand Up @@ -666,8 +666,8 @@ Supported options:
@item preallocation
Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}).
@code{falloc} mode preallocates space for image by calling posix_fallocate().
@code{full} mode preallocates space for image by writing zeros to underlying
storage.
@code{full} mode preallocates space for image by writing data to underlying
storage. This data may or may not be zero, depending on the storage location.
@end table
@item qcow2
Expand Down

0 comments on commit fa27c47

Please sign in to comment.