diff options
author | Fam Zheng <famz@redhat.com> | 2016-09-28 15:04:21 +0800 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-10-24 17:54:03 +0200 |
commit | 170f4b2e5cf43895399f57ca4287f26c713be654 (patch) | |
tree | 2d944a6be32df15e1cd137cc443f200602ae4aa7 /block/qcow2.c | |
parent | e84a0dd5a75d8e89bec05fac432941988191df32 (diff) | |
download | qemu-170f4b2e5cf43895399f57ca4287f26c713be654.zip qemu-170f4b2e5cf43895399f57ca4287f26c713be654.tar.gz qemu-170f4b2e5cf43895399f57ca4287f26c713be654.tar.bz2 |
qcow2: Support BDRV_REQ_MAY_UNMAP
Handling this is similar to what is done to the L2 entry in the case of
compressed clusters.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r-- | block/qcow2.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/block/qcow2.c b/block/qcow2.c index e11c7c9..6d5689a 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1155,6 +1155,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags, /* Initialise locks */ qemu_co_mutex_init(&s->lock); + bs->supported_zero_flags = BDRV_REQ_MAY_UNMAP; /* Repair image if dirty */ if (!(flags & (BDRV_O_CHECK | BDRV_O_INACTIVE)) && !bs->read_only && @@ -2477,7 +2478,7 @@ static coroutine_fn int qcow2_co_pwrite_zeroes(BlockDriverState *bs, trace_qcow2_pwrite_zeroes(qemu_coroutine_self(), offset, count); /* Whatever is left can use real zero clusters */ - ret = qcow2_zero_clusters(bs, offset, count >> BDRV_SECTOR_BITS); + ret = qcow2_zero_clusters(bs, offset, count >> BDRV_SECTOR_BITS, flags); qemu_co_mutex_unlock(&s->lock); return ret; |