summary refs log tree commit diff stats
path: root/include
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2020-05-28 12:44:04 +0300
committerMax Reitz <mreitz@redhat.com>2020-07-06 10:34:14 +0200
commita2adbbf603cee443ca923f6e8546267a706567d5 (patch)
treedb3c6df1347a108d1a39791cf8a3a8b22c9fee6a /include
parentcdf9ebf18f32f4b29f99af58e154a9afe93bbc92 (diff)
downloadfocaccia-qemu-a2adbbf603cee443ca923f6e8546267a706567d5.tar.gz
focaccia-qemu-a2adbbf603cee443ca923f6e8546267a706567d5.zip
block: drop unallocated_blocks_are_zero
Currently this field only set by qed and qcow2. But in fact, all
backing-supporting formats (parallels, qcow, qcow2, qed, vmdk) share
these semantics: on unallocated blocks, if there is no backing file they
just memset the buffer with zeroes.

So, document this behavior for .supports_backing and drop
.unallocated_blocks_are_zero

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200528094405.145708-10-vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/block.h5
-rw-r--r--include/block/block_int.h12
2 files changed, 11 insertions, 6 deletions
diff --git a/include/block/block.h b/include/block/block.h
index e7934e07f2..bca3bb831c 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -22,11 +22,6 @@ typedef struct BlockDriverInfo {
     int64_t vm_state_offset;
     bool is_dirty;
     /*
-     * True if unallocated blocks read back as zeroes. This is equivalent
-     * to the LBPRZ flag in the SCSI logical block provisioning page.
-     */
-    bool unallocated_blocks_are_zero;
-    /*
      * True if this block driver only supports compressed writes
      */
     bool needs_compressed_writes;
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 1b86b59af1..3d6cf88592 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -123,7 +123,17 @@ struct BlockDriver {
      */
     bool bdrv_needs_filename;
 
-    /* Set if a driver can support backing files */
+    /*
+     * Set if a driver can support backing files. This also implies the
+     * following semantics:
+     *
+     *  - Return status 0 of .bdrv_co_block_status means that corresponding
+     *    blocks are not allocated in this layer of backing-chain
+     *  - For such (unallocated) blocks, read will:
+     *    - fill buffer with zeros if there is no backing file
+     *    - read from the backing file otherwise, where the block layer
+     *      takes care of reading zeros beyond EOF if backing file is short
+     */
     bool supports_backing;
 
     /* For handling image reopen for split or non-split files */