From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYwV5-00070A-9q for qemu-devel@nongnu.org; Tue, 30 Sep 2014 08:26:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYwUs-0002yr-Ks for qemu-devel@nongnu.org; Tue, 30 Sep 2014 08:25:51 -0400 Received: from mail-wg0-x22e.google.com ([2a00:1450:400c:c00::22e]:56578) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYwUs-0002yB-De for qemu-devel@nongnu.org; Tue, 30 Sep 2014 08:25:38 -0400 Received: by mail-wg0-f46.google.com with SMTP id k14so4890713wgh.29 for ; Tue, 30 Sep 2014 05:25:32 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 30 Sep 2014 14:24:44 +0200 Message-Id: <1412079919-18857-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1412079919-18857-1-git-send-email-pbonzini@redhat.com> References: <1412079919-18857-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 04/39] virtio-scsi: clean up virtio_scsi_parse_cdb List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Laszlo Ersek 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 --- hw/scsi/virtio-scsi.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index f0d21a3..6953cbe 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; } -- 1.8.3.1