Re: [PATCH 17/17] IB/srp: Detect bidi commands properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/23/2015 2:17 PM, Bart Van Assche wrote:
The SCSI core never sets sc_data_direction to DMA_BIDIRECTIONAL. This allows
to simplify srp_unmap_data(). Fix the bidi test in srp_map_data().

Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
Cc: Roland Dreier <roland@xxxxxxxxxx>
---
  drivers/infiniband/ulp/srp/ib_srp.c | 10 +++-------
  1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 0747c05..22b7529 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1063,9 +1063,7 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd,
  	struct ib_device *ibdev = dev->dev;
  	int i, res;

-	if (!scsi_sglist(scmnd) ||
-	    (scmnd->sc_data_direction != DMA_TO_DEVICE &&
-	     scmnd->sc_data_direction != DMA_FROM_DEVICE))
+	if (!scsi_sglist(scmnd))
  		return;

  	if (dev->use_fast_reg) {
@@ -1524,11 +1522,9 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_rdma_ch *ch,
  	if (!scsi_sglist(scmnd) || scmnd->sc_data_direction == DMA_NONE)
  		return sizeof (struct srp_cmd);

-	if (scmnd->sc_data_direction != DMA_FROM_DEVICE &&
-	    scmnd->sc_data_direction != DMA_TO_DEVICE) {
+	if (scsi_bidi_cmnd(scmnd)) {
  		shost_printk(KERN_WARNING, target->scsi_host,
-			     PFX "Unhandled data direction %d\n",
-			     scmnd->sc_data_direction);
+			     PFX "Bidi commands are not yet supported\n");
  		return -EINVAL;
  	}



Looks good.

Acked-by: Sagi Grimberg <sagig@xxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux