This series fixes the implementation of WRITE SAME in the SCSI emulation layer. On top of this, it ensures that zero writes from the guest can be offloaded to the host device or filesystem if that's supported. This is a relatively important part of the thin provisioning feature, and builds on the unmap flag to write_zeroes, recently added by Peter Lieven. The feature works with iscsi, block device and filesystem targets.
The block layer patches are 1-3 (adding prerequisites for using the feature in scsi-disk) and 7-11 (which support the feature on non-iscsi targets). Paolo Bonzini (11): block: generalize BlockLimits handling to cover bdrv_aio_discard too block: add flags to BlockRequest block: add bdrv_aio_write_zeroes scsi-disk: catch write protection errors in UNMAP scsi-disk: reject ANCHOR=1 for UNMAP and WRITE SAME commands scsi-disk: correctly implement WRITE SAME block: handle ENOTSUP from discard in generic code raw-posix: implement write_zeroes with MAY_UNMAP for files raw-posix: implement write_zeroes with MAY_UNMAP for block devices raw-posix: add support for write_zeroes on XFS and block devices qemu-iotests: 033 is fast block.c | 108 +++++++++++++++++------------ block/raw-aio.h | 3 +- block/raw-posix.c | 173 +++++++++++++++++++++++++++++++++++++++++++++-- hw/scsi/scsi-disk.c | 154 ++++++++++++++++++++++++++++++++++------- include/block/block.h | 4 ++ tests/qemu-iotests/group | 2 +- trace-events | 2 + 7 files changed, 369 insertions(+), 77 deletions(-) -- 1.8.4.2