Commit Message

Nowaday SCSI drivers in guests are able to alight UNMAP requests before
sending to the device. Right now QEMU provides an ability to set
this via "discard_granularity" property of the block device which could
be used by management layer.
Though, in particular, from the point of QEMU, there is
pdiscard_granularity on the format driver level, f.e. on QCOW2 or iSCSI.
It would be beneficial to pass this value as a default for this
property.
Technically this should reduce the amount of useless UNMAP requests
from the guest to the host.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Fam Zheng <fam@euphon.net>
---
block/block-backend.c | 13 +++++++++++++
hw/scsi/scsi-disk.c | 4 ++--
include/sysemu/block-backend.h | 1 +
3 files changed, 16 insertions(+), 2 deletions(-)

Comments

Am 26.02.2019 um 15:59 hat Denis V. Lunev geschrieben:
> Nowaday SCSI drivers in guests are able to alight UNMAP requests before
Is s/alight/align/ what you mean?
The subject line has an "alignment" typo, too.
> sending to the device. Right now QEMU provides an ability to set> this via "discard_granularity" property of the block device which could> be used by management layer.> > Though, in particular, from the point of QEMU, there is> pdiscard_granularity on the format driver level, f.e. on QCOW2 or iSCSI.> It would be beneficial to pass this value as a default for this> property.> > Technically this should reduce the amount of useless UNMAP requests> from the guest to the host.> > Signed-off-by: Denis V. Lunev <den@openvz.org>> CC: Kevin Wolf <kwolf@redhat.com>> CC: Max Reitz <mreitz@redhat.com>> CC: Paolo Bonzini <pbonzini@redhat.com>> CC: Fam Zheng <fam@euphon.net>
I'm not doing things like this very often, but you're touching the guest
ABI here, which is a bit tricky. The main point is that the same command
line must result in the same guest view.
You'll need at least some machine type magic to make old machine types
use the old defaults. I'm not sure if there's something else to consider
for migration compatibility.
Kevin

On 2/26/19 6:51 PM, Kevin Wolf wrote:
> Am 26.02.2019 um 15:59 hat Denis V. Lunev geschrieben:>> Nowaday SCSI drivers in guests are able to alight UNMAP requests before> Is s/alight/align/ what you mean?>> The subject line has an "alignment" typo, too.>>> sending to the device. Right now QEMU provides an ability to set>> this via "discard_granularity" property of the block device which could>> be used by management layer.>>>> Though, in particular, from the point of QEMU, there is>> pdiscard_granularity on the format driver level, f.e. on QCOW2 or iSCSI.>> It would be beneficial to pass this value as a default for this>> property.>>>> Technically this should reduce the amount of useless UNMAP requests>> from the guest to the host.>>>> Signed-off-by: Denis V. Lunev <den@openvz.org>>> CC: Kevin Wolf <kwolf@redhat.com>>> CC: Max Reitz <mreitz@redhat.com>>> CC: Paolo Bonzini <pbonzini@redhat.com>>> CC: Fam Zheng <fam@euphon.net>> I'm not doing things like this very often, but you're touching the guest> ABI here, which is a bit tricky. The main point is that the same command> line must result in the same guest view.>> You'll need at least some machine type magic to make old machine types> use the old defaults. I'm not sure if there's something else to consider> for migration compatibility.>> Kevin
sounds reasonable, thank you for the suggestion.
I was fascinated with the fact that
a) change is not disruptive
b) the guest actually do not read this value except on controller reset and
it is safe to return different value on a new request. This is not a
very
big deal.
Den