qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 08/19] block drivers: add discard/write_zeroe


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v3 08/19] block drivers: add discard/write_zeroes properties to bdrv_get_info implementation
Date: Tue, 3 Dec 2013 16:09:15 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

Am 22.11.2013 um 13:39 hat Paolo Bonzini geschrieben:
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  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

[Prev in Thread] Current Thread [Next in Thread]