aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2.h
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2019-05-10 19:22:54 +0300
committerKevin Wolf <kwolf@redhat.com>2019-05-20 17:08:56 +0200
commitb6c246942b14d3e0dec46a6c5868ed84e7dbea19 (patch)
treece424eaf7dd574d6ae54e64dcc380dac9c2de656 /block/qcow2.h
parent50ba5b2d994853b38fed10e0841b119da0f8b8e5 (diff)
downloadqemu-b6c246942b14d3e0dec46a6c5868ed84e7dbea19.zip
qemu-b6c246942b14d3e0dec46a6c5868ed84e7dbea19.tar.gz
qemu-b6c246942b14d3e0dec46a6c5868ed84e7dbea19.tar.bz2
qcow2: Define and use QCOW2_COMPRESSED_SECTOR_SIZE
When an L2 table entry points to a compressed cluster the space used by the data is specified in 512-byte sectors. This size is independent from BDRV_SECTOR_SIZE and is specific to the qcow2 file format. The QCOW2_COMPRESSED_SECTOR_SIZE constant defined in this patch makes this explicit. Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2.h')
-rw-r--r--block/qcow2.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/block/qcow2.h b/block/qcow2.h
index e62508d..8d92ef1 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -74,6 +74,10 @@
#define MIN_CLUSTER_BITS 9
#define MAX_CLUSTER_BITS 21
+/* Defined in the qcow2 spec (compressed cluster descriptor) */
+#define QCOW2_COMPRESSED_SECTOR_SIZE 512U
+#define QCOW2_COMPRESSED_SECTOR_MASK (~(QCOW2_COMPRESSED_SECTOR_SIZE - 1))
+
/* Must be at least 2 to cover COW */
#define MIN_L2_CACHE_SIZE 2 /* cache entries */