RE: [virtio-dev] Clarifications for the new DISCARD and WRITE ZEROES commands

From
Liu, Changpeng <>
Date
2018-08-16T00:25:09+00:00
ID
Thread
RE: [virtio-dev] Clarifications for the new DISCARD and WRITE ZEROES commands
Hi Jakub,

The latest patch set for adding DISCARD and WRITE ZEROES to virtio-blk locates here, 
https://lists.linuxfoundation.org/pipermail/virtualization/2018-June/038299.html



> -----Original Message-----
> From:  [mailto:] On
> Behalf Of Jakub Jermar
> Sent: Thursday, August 16, 2018 5:33 AM
> To: 
> Subject: Re: [virtio-dev] Clarifications for the new DISCARD and WRITE ZEROES
> commands
> 
> On 08/15/2018 05:47 PM, Paolo Bonzini wrote:
> > On 15/08/2018 17:12, Jakub Jermar wrote:
> >> In the absence of such a conforming patch, I would kindly ask someone to
> >> clarify the relationship between the virtio_blk_discard_write_zeroes
> >> structures and the virtio descriptor. [1] seems to indicate that there
> >> is always one struct virtio_blk_discard_write_zeroes per descriptor, but
> >> the wording is not very clear. If the containing descriptor must be a
> >> multiple of 512 in size (because of u8 data[][512]),
> >
> > The descriptors are intended to be a multiple of 16 bytes in size for
> > discard and write zeroes.
> >
> > In fact, even for reads/writes the descriptors are a multiple of the
> > logical block size, not of 512.  That ought to be corrected as well.
> >
> >> there is no way to
> >> figure out how many of these structs it contains. So there must be only
> >> one and the only way to add a segment is to chain descriptors.
> >
> > No, it does not matter how descriptors are chained.  Data is always
> > treated as if it was just one descriptor.
> >
> >> Unless
> >> the descriptor size is somehow allowed to be a multiple of sizeof(struct
> >> virtio_blk_discard_write_zeroes) in which case it could be determined
> >> and there may be several of these structures per descriptor.
> >>
> >> Also, why is it that there is discard_sector_alignment but no
> >> write_zeroes_sector_alignment?
> >
> > You can use discard_zeroes_alignment too if unmap=1 in the descriptor's
> > flags.  If unmap=0, it doesn't matter.
> 
> Thank you, that was quite helpful.
> 
> Jakub
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> For additional commands, e-mail: