aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2.h
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2019-02-22 14:29:38 +0100
committerKevin Wolf <kwolf@redhat.com>2019-03-08 12:26:46 +0100
commit6c3944dc6219cefef6a968cf300d227fe3f92388 (patch)
treea29c719a0dd5e302ee767a839512cd388d940f93 /block/qcow2.h
parent9b890bdcb6ec11868da92c1daeb51c69d9483da8 (diff)
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>
Diffstat (limited to 'block/qcow2.h')
-rw-r--r--block/qcow2.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/block/qcow2.h b/block/qcow2.h
index a9c9cb4a26..de2a3bdfc5 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -225,7 +225,8 @@ enum {
QCOW2_AUTOCLEAR_BITMAPS = 1 << QCOW2_AUTOCLEAR_BITMAPS_BITNR,
QCOW2_AUTOCLEAR_DATA_FILE_RAW = 1 << QCOW2_AUTOCLEAR_DATA_FILE_RAW_BITNR,
- QCOW2_AUTOCLEAR_MASK = QCOW2_AUTOCLEAR_BITMAPS,
+ QCOW2_AUTOCLEAR_MASK = QCOW2_AUTOCLEAR_BITMAPS
+ | QCOW2_AUTOCLEAR_DATA_FILE_RAW,
};
enum qcow2_discard_type {
@@ -474,6 +475,12 @@ static inline bool has_data_file(BlockDriverState *bs)
return (s->data_file != bs->file);
}
+static inline bool data_file_is_raw(BlockDriverState *bs)
+{
+ BDRVQcow2State *s = bs->opaque;
+ return !!(s->autoclear_features & QCOW2_AUTOCLEAR_DATA_FILE_RAW);
+}
+
static inline int64_t start_of_cluster(BDRVQcow2State *s, int64_t offset)
{
return offset & ~(s->cluster_size - 1);