virtio-blk: Respect discard granularity
commitfb0b154c801e3447e505de420195fb7038695941
authorAkihiko Odaki <akihiko.odaki@gmail.com>
Thu, 25 Feb 2021 00:12:39 +0000 (25 09:12 +0900)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 15 Mar 2021 09:48:53 +0000 (15 09:48 +0000)
treea060af2e30b44fddad72be77331c4dad8ca12b61
parent6157b0e19721aadb4c7fdcfe57b2924af6144b14
virtio-blk: Respect discard granularity

Report the configured granularity for discard operation to the
guest. If this is not set use the block size.

Since until now we have ignored the configured discard granularity
and always reported the block size, let's add
'report-discard-granularity' property and disable it for older
machine types to avoid migration issues.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210225001239.47046-1-akihiko.odaki@gmail.com>
hw/block/virtio-blk.c
hw/core/machine.c
include/hw/virtio/virtio-blk.h