vdpa_sim_blk: add support for discard and write-zeroes
authorStefano Garzarella <sgarzare@redhat.com>
Thu, 11 Aug 2022 08:36:32 +0000 (10:36 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 11 Aug 2022 08:44:58 +0000 (04:44 -0400)
commit4a44a5eda245453ed7bd14239c596262cb53b665
tree709be0e6e91202e07ba66729236949d29ef193f0
parent518083d2f5b2e7c91549ac1723923e8ae3d679ca
vdpa_sim_blk: add support for discard and write-zeroes

Expose VIRTIO_BLK_F_DISCARD and VIRTIO_BLK_F_WRITE_ZEROES features
to the drivers and handle VIRTIO_BLK_T_DISCARD and
VIRTIO_BLK_T_WRITE_ZEROES requests checking ranges and flags.

The simulator behaves like a ramdisk, so for VIRTIO_BLK_F_DISCARD
does nothing, while for VIRTIO_BLK_T_WRITE_ZEROES sets to 0 the
specified region.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20220811083632.77525-5-sgarzare@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/vdpa/vdpa_sim/vdpa_sim_blk.c