From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laszlo Ersek <lersek@redhat.com>
Subject: [Qemu-devel] [PATCH] virtio-scsi: clean up virtio_scsi_parse_cdb
Date: Thu, 18 Sep 2014 16:58:22 +0200 [thread overview]
Message-ID: <1411052302-10459-1-git-send-email-pbonzini@redhat.com> (raw)
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 <lersek@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
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
next reply other threads:[~2014-09-18 14:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-18 14:58 Paolo Bonzini [this message]
2014-09-18 15:43 ` [Qemu-devel] [PATCH] virtio-scsi: clean up virtio_scsi_parse_cdb Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411052302-10459-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=lersek@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).