aboutsummaryrefslogtreecommitdiff
path: root/block/qcow2.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2012-03-16 15:02:38 +0100
committerKevin Wolf <kwolf@redhat.com>2012-04-20 15:57:29 +0200
commit6377af48b0445e7ee50db6e0bd73a3a70098f5f4 (patch)
treee3b5171b5645490af6a392662790d7de88247a69 /block/qcow2.c
parent6744cbab8cd63b7ce72b3eee4f0055007acf0798 (diff)
qcow2: Support reading zero clusters
This adds support for reading zero clusters in version 3 images. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r--block/qcow2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index 3e1482fa7e..9a8b354d0e 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -536,6 +536,14 @@ static coroutine_fn int qcow2_co_readv(BlockDriverState *bs, int64_t sector_num,
}
break;
+ case QCOW2_CLUSTER_ZERO:
+ if (s->qcow_version < 3) {
+ ret = -EIO;
+ goto fail;
+ }
+ qemu_iovec_memset(&hd_qiov, 0, 512 * cur_nr_sectors);
+ break;
+
case QCOW2_CLUSTER_COMPRESSED:
/* add AIO support for compressed blocks ? */
ret = qcow2_decompress_cluster(bs, cluster_offset);