mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
qcow2: Implement data-file-raw create option
Provide an option to force QEMU to always keep the external data file consistent as a standalone read-only raw image. At the moment, this means making sure that write_zeroes requests are forwarded to the data file instead of just updating the metadata, and checking that no backing file is used. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
9b890bdcb6
commit
6c3944dc62
6 changed files with 109 additions and 3 deletions
|
@ -1783,6 +1783,16 @@ int qcow2_cluster_zeroize(BlockDriverState *bs, uint64_t offset,
|
|||
int64_t cleared;
|
||||
int ret;
|
||||
|
||||
/* If we have to stay in sync with an external data file, zero out
|
||||
* s->data_file first. */
|
||||
if (data_file_is_raw(bs)) {
|
||||
assert(has_data_file(bs));
|
||||
ret = bdrv_co_pwrite_zeroes(s->data_file, offset, bytes, flags);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Caller must pass aligned values, except at image end */
|
||||
assert(QEMU_IS_ALIGNED(offset, s->cluster_size));
|
||||
assert(QEMU_IS_ALIGNED(end_offset, s->cluster_size) ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue