Am 22.11.2013 um 13:39 hat Paolo Bonzini geschrieben:
> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
> ---
>  block/qcow2.c | 2 ++
>  block/qed.c   | 2 ++
>  block/vdi.c   | 1 +
>  block/vhdx.c  | 3 +++
>  block/vpc.c   | 1 +
>  5 files changed, 9 insertions(+)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 2fe37ed..1542750 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -1892,6 +1892,8 @@ static coroutine_fn int 
> qcow2_co_flush_to_os(BlockDriverState *bs)
>  static int qcow2_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
>  {
>      BDRVQcowState *s = bs->opaque;
> +    bdi->unallocated_blocks_are_zero = true;
> +    bdi->can_write_zeroes_with_unmap = (s->qcow_version >= 3);
>      bdi->cluster_size = s->cluster_size;
>      bdi->vm_state_offset = qcow2_vm_state_offset(s);
>      return 0;

We must change qcow2_discard_clusters() to set the zero flag instead of
just deallocating the cluster. (We should be doing that anyway, because
the backing file reappearing isn't very nice.)

Not quite sure what to do with version 2 images, though.

For the other formats, I guess this is only correct because they don't
implement discard anyway?

Kevin

Reply via email to