summaryrefslogtreecommitdiffstats
path: root/block/qcow.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-09-04 19:00:30 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2013-09-06 15:25:09 +0200
commit4bc74be997a72922170f4f272fd5e8074a3ecc27 (patch)
treec3b466014f752398a8b9543e99da0651bb12c759 /block/qcow.c
parent4333bb71405f58a8dc8d3255feb3ca5960b0daf8 (diff)
downloadhqemu-4bc74be997a72922170f4f272fd5e8074a3ecc27.zip
hqemu-4bc74be997a72922170f4f272fd5e8074a3ecc27.tar.gz
block: return get_block_status data and flags for formats
Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/qcow.c')
-rw-r--r--block/qcow.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/block/qcow.c b/block/qcow.c
index 0d76656..93a993b 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -410,7 +410,14 @@ static int64_t coroutine_fn qcow_co_get_block_status(BlockDriverState *bs,
if (n > nb_sectors)
n = nb_sectors;
*pnum = n;
- return (cluster_offset != 0);
+ if (!cluster_offset) {
+ return 0;
+ }
+ if ((cluster_offset & QCOW_OFLAG_COMPRESSED) || s->crypt_method) {
+ return BDRV_BLOCK_DATA;
+ }
+ cluster_offset |= (index_in_cluster << BDRV_SECTOR_BITS);
+ return BDRV_BLOCK_DATA | BDRV_BLOCK_OFFSET_VALID | cluster_offset;
}
static int decompress_buffer(uint8_t *out_buf, int out_buf_size,
OpenPOWER on IntegriCloud