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 <lersek@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
7ce0425575
commit
9df7bfddcc
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user