From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUebu-000081-PB for qemu-devel@nongnu.org; Thu, 18 Sep 2014 12:31:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUebn-0000jJ-IT for qemu-devel@nongnu.org; Thu, 18 Sep 2014 12:31:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46187) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUebn-0000iT-6r for qemu-devel@nongnu.org; Thu, 18 Sep 2014 12:31:03 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8IFi2l9015933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 18 Sep 2014 11:44:03 -0400 Message-ID: <541AFDBF.8050103@redhat.com> Date: Thu, 18 Sep 2014 17:43:59 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1411052302-10459-1-git-send-email-pbonzini@redhat.com> In-Reply-To: <1411052302-10459-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] virtio-scsi: clean up virtio_scsi_parse_cdb List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org On 09/18/14 16:58, Paolo Bonzini wrote: > 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; > } > > virtio_scsi_handle_cmd() [hw/scsi/virtio-scsi.c] virtio_scsi_parse_req() [hw/scsi/virtio-scsi.c] /* sets req->mode */ scsi_req_new() [hw/scsi/scsi-bus.c] scsi_block_parse_cdb() | scsi_generic_parse_cdb() [hw/scsi/scsi-disk.c | hw/scsi/scsi-generic.c] scsi_bus_parse_cdb() [hw/scsi/scsi-bus.c] virtio_scsi_parse_cdb() [hw/scsi/virtio-scsi.c] /* uses req->mode */ Reviewed-by: Laszlo Ersek