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: Peter Lieven
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 18:10:39 +0100

> unallocated_blocks_are_zero  is false if there is a backing hd. Same as 
> has_zero_init.

Peter 

> Am 03.12.2013 um 16:21 schrieb Paolo Bonzini <address@hidden>:
> 
> Il 03/12/2013 16:09, Kevin Wolf ha scritto:
>>>>     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.)
> 
> No, that's not needed:
> 
> * unallocated_blocks_are_zero is only meaningful for bs->backing_hd ==
> NULL (not too intuitive, but I didn't introduce that interface :)).  In
> fact, v2 was checking backing_hd == NULL but I removed it after Peter
> noticed I was being inconsistent.
> 
> * can_write_zeroes_with_unmap correctly returns true only if zero
> clusters are enabled
> 
>> For the other formats, I guess this is only correct because they don't
>> implement discard anyway?
> 
> No, it is correct because that's what their bdrv_co_readv (or similar)
> will return when a block is not allocated and there is no backing file.
> Of course, for many formats there will never be a backing file.
> 
> Paolo



reply via email to

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