On Tue, Jul 04, 2017 at 11:24:01AM +0200, Paolo Bonzini wrote: > > > On 05/07/2017 10:44, Changpeng Liu wrote: > > Currently virtio-blk driver does not provide discard feature flag, so the > > filesystems which built on top of the block device will not send discard > > command. This is okay for HDD backend, but it will impact the performance > > for SSD backend. > > > > Add a feature flag VIRTIO_BLK_F_DISCARD and command VIRTIO_BLK_T_DISCARD > > to extend exist virtio-blk protocol, define 16 bytes discard descriptor > > for each discard segment, the discard segment defination aligns with > > SCSI or NVM Express protocols, virtio-blk driver will support multi-range > > discard request as well. > > > > Signed-off-by: Changpeng Liu <changpeng.liu@xxxxxxxxx> > > Please include a patch for the specification. Most importantly, please remember to copy virtio-dev@xxxxxxxxxxxxxxxxxxxx on anything that changes the host/guest interface. > Since we are at it, I > would like to have three operations defined using the same descriptor: > > - discard (SCSI UNMAP) > > - write zeroes (SCSI WRITE SAME without UNMAP flag) > > - write zeroes and possibly discard (SCSI WRITE SAME with UNMAP flag) > > The last two can use the same command VIRTIO_BLK_T_WRITE_ZEROES, using > the reserved field as a flags field. > > Paolo > > --- > > drivers/block/virtio_blk.c | 76 +++++++++++++++++++++++++++++++++++++++-- > > include/uapi/linux/virtio_blk.h | 19 +++++++++++ > > 2 files changed, 92 insertions(+), 3 deletions(-) _______________________________________________ Virtualization mailing list Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization