[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 0/4] scsi-block: receive the right SCSI status on re
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 0/4] scsi-block: receive the right SCSI status on reads and writes |
Date: |
Wed, 11 May 2016 13:41:09 +0200 |
scsi-block uses the block layer for reads and writes in order to avoid
allocating bounce buffers as big as the transferred data. We know how
to split a large transfer to multiple reads and writes, and thus we can
use scsi-disk.c's existing code to do I/O in multiple chunks (for non-s/g
SCSI hosts) or through the DMA helpers (for s/g SCSI hosts).
Unfortunately, this has the side effect of eating the SCSI status except
in the very few cases where we can convert an errno code back to a SCSI
status. It puts a big wrench in persistent reservations support in the
guest, for example.
Luckily, splitting a large transfer into multiple SBC commands is just as
easy, and this is what the last patch does. It takes the original CDB,
patches in a modified starting sector and sector count, and executes the
SCSI command through blk_aio_ioctl. It is also easy to pass a QEMUIOVector
to SG_IO, so that s/g SCSI hosts keep the performance.
The other patches are preparatory work. Patch 2 modifies the DMA helpers
to make the API more flexible, because the SCSI subsystem would like to
have a SCSIRequest pointer passed to the I/O function instead of the
BlockBackend pointer. Patches 1 and 3 introduce the two callbacks that
scsi-block can override.
This conflicts with Eric's work on the byte-based API; I plan to rebase it
once those patches are in. In the meanwhile, I would especially appreciate
the review of patch 2.
Paolo Bonzini (4):
scsi-disk: introduce a common base class
dma-helpers: change BlockBackend to opaque value in DMAIOFunc
scsi-disk: introduce dma_readv and dma_writev
scsi-block: always use SG_IO
dma-helpers.c | 51 +++++++++---
hw/ide/core.c | 12 +--
hw/ide/internal.h | 4 +-
hw/ide/macio.c | 4 +-
hw/scsi/scsi-disk.c | 229 ++++++++++++++++++++++++++++++++++++++++++---------
include/sysemu/dma.h | 11 +--
6 files changed, 247 insertions(+), 64 deletions(-)
--
2.5.5
- [Qemu-devel] [PATCH 0/4] scsi-block: receive the right SCSI status on reads and writes,
Paolo Bonzini <=