aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2019-08-20 10:27:24 +0100
committerPeter Maydell <peter.maydell@linaro.org>2019-08-20 10:27:24 +0100
commit156d320349df5d17e1c4fbf11fad70d2d93f5e26 (patch)
tree0a78ac22f22d415ce806a87ac8a44e1e9d74dc83 /include
parent6894576347a71cdf7a1638650ccf3378cfa2a22d (diff)
parentfa27c478102a6b5d1c6b02c005607ad9404b915f (diff)
Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2019-08-19' into staging
Block patches: - preallocation=falloc/full support for LUKS - Various minor fixes # gpg: Signature made Mon 19 Aug 2019 16:36:45 BST # gpg: using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40 # gpg: issuer "mreitz@redhat.com" # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full] # Primary key fingerprint: 91BE B60A 30DB 3E88 57D1 1829 F407 DB00 61D5 CF40 * remotes/maxreitz/tags/pull-block-2019-08-19: doc: Preallocation does not require writing zeroes iotests: Fix 141 when run with qed vpc: Do not return RAW from block_status vmdk: Make block_status recurse for flat extents vdi: Make block_status recurse for fixed images iotests: Full mirror to existing non-zero image iotests: Test convert -n to pre-filled image iotests: Convert to preallocated encrypted qcow2 vhdx: Fix .bdrv_has_zero_init() vdi: Fix .bdrv_has_zero_init() qcow2: Fix .bdrv_has_zero_init() block: Use bdrv_has_zero_init_truncate() block: Implement .bdrv_has_zero_init_truncate() block: Add bdrv_has_zero_init_truncate() mirror: Fix bdrv_has_zero_init() use qemu-img: Fix bdrv_has_zero_init() use in convert LUKS: support preallocation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/block/block.h1
-rw-r--r--include/block/block_int.h9
2 files changed, 10 insertions, 0 deletions
diff --git a/include/block/block.h b/include/block/block.h
index 89e40318cf..124ad40809 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -443,6 +443,7 @@ int bdrv_pdiscard(BdrvChild *child, int64_t offset, int64_t bytes);
int bdrv_co_pdiscard(BdrvChild *child, int64_t offset, int64_t bytes);
int bdrv_has_zero_init_1(BlockDriverState *bs);
int bdrv_has_zero_init(BlockDriverState *bs);
+int bdrv_has_zero_init_truncate(BlockDriverState *bs);
bool bdrv_unallocated_blocks_are_zero(BlockDriverState *bs);
bool bdrv_can_write_zeroes_with_unmap(BlockDriverState *bs);
int bdrv_block_status(BlockDriverState *bs, int64_t offset,
diff --git a/include/block/block_int.h b/include/block/block_int.h
index aa697f1f69..ceec8c2f56 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -419,9 +419,16 @@ struct BlockDriver {
/*
* Returns 1 if newly created images are guaranteed to contain only
* zeros, 0 otherwise.
+ * Must return 0 if .bdrv_has_zero_init_truncate() returns 0.
*/
int (*bdrv_has_zero_init)(BlockDriverState *bs);
+ /*
+ * Returns 1 if new areas added by growing the image with
+ * PREALLOC_MODE_OFF contain only zeros, 0 otherwise.
+ */
+ int (*bdrv_has_zero_init_truncate)(BlockDriverState *bs);
+
/* Remove fd handlers, timers, and other event loop callbacks so the event
* loop is no longer in use. Called with no in-flight requests and in
* depth-first traversal order with parents before child nodes.
@@ -1115,6 +1122,7 @@ BlockJob *commit_active_start(const char *job_id, BlockDriverState *bs,
* @buf_size: The amount of data that can be in flight at one time.
* @mode: Whether to collapse all images in the chain to the target.
* @backing_mode: How to establish the target's backing chain after completion.
+ * @zero_target: Whether the target should be explicitly zero-initialized
* @on_source_error: The action to take upon error reading from the source.
* @on_target_error: The action to take upon error writing to the target.
* @unmap: Whether to unmap target where source sectors only contain zeroes.
@@ -1134,6 +1142,7 @@ void mirror_start(const char *job_id, BlockDriverState *bs,
int creation_flags, int64_t speed,
uint32_t granularity, int64_t buf_size,
MirrorSyncMode mode, BlockMirrorBackingMode backing_mode,
+ bool zero_target,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
bool unmap, const char *filter_node_name,