From: Paolo Bonzini Date: Wed, 17 Sep 2014 16:10:37 +0000 (+0200) Subject: virtio-scsi: clean up virtio_scsi_parse_cdb X-Git-Tag: qemu-xen-4.6.0-rc1~144^2~35 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9df7bfddcc25a22b99be5fe9b14ce367fa43b106;p=qemu-upstream-4.6-testing.git virtio-scsi: clean up virtio_scsi_parse_cdb The command direction according to the guest-passed buffers is already stored in the VirtIOSCSIReq. We can use it instead of computing it again from req->elem. Cc: Laszlo Ersek Signed-off-by: Paolo Bonzini --- diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index f0d21a3fd..6953cbe6d 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -430,13 +430,7 @@ static int virtio_scsi_parse_cdb(SCSIDevice *dev, SCSICommand *cmd, * host device passthrough. */ cmd->xfer = req->qsgl.size; - if (cmd->xfer == 0) { - cmd->mode = SCSI_XFER_NONE; - } else if (iov_size(req->elem.in_sg, req->elem.in_num) > req->resp_size) { - cmd->mode = SCSI_XFER_FROM_DEV; - } else { - cmd->mode = SCSI_XFER_TO_DEV; - } + cmd->mode = req->mode; return 0; }