> Am 13.11.2013 um 15:39 schrieb Paolo Bonzini <pbonz...@redhat.com>:
> 
> Il 13/11/2013 15:14, Peter Lieven ha scritto:
>>>>>> does BLKDISCARDZEROES ioctl guarantee that a device is
>>>>>> zero initialized or does it just guarantee that a discard may not
>>>>>> fail and that it reads as zeroes afterwards?
>>>> 
>>>> Only the latter.  ".bdrv_has_zero_init" is only present in the bdrv_file
>>>> BlockDriver.
>> Then bdi->unallocated_blocks_are_zero must stay 0. .bdrv_has_zero_init's
>> semantic is to reflect the zero status of all blocks of the device right 
>> after bdrv_create
>> independently of their allocation status. bdi->unallocated_blocks_are_zero
>> reflects the zero status of every unallocated block regardless if it was
>> unallocated right from the beginning or became unallocated through a discard.
> 
> What we have is:
> 
> * bdi->unallocated_blocks_are_zero returns true
> 
> * bdrv_create doesn't ensure that every block starts unallocated
> 
> * hence bdrv_has_zero_init returns false
> 
> Blocks that (for any reason) are unallocated after bdrv_create *will* be
> zero if BLKDISCARDZEROES returns true.

Ok, then i misunderstood your comment. If BLKDISCARDZEROES means lbprz == 1 
SCSI speaking then you are right.

Peter

> 
> Paolo

Reply via email to