Re: [PATCH v2 1/3] scsi_cmnd: Introduce scsi_transfer_length helper

Mike Christie
2014-06-24T17:05:53Z

On 06/24/2014 11:31 AM, Martin K. Petersen wrote:
>>>>>> "Mike" == Michael Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org> writes:
>
> Mike> Do we need to check for the data direction. Something like
>
> Mike> if (scmd->sc_data_direction == DMA_TO_DEVICE)
> Mike> xfer_len = scsi_out(scmnd)->length;
> Mike> else
> Mike> xfer_len = scsi_in(scmnd)->length;
>
> I guess that depends on the context the wrapper is called in. I think
> iscsi is the only place where there's a distinction thanks to bidi.
>

We were using it generically, so we did not check if bidi or t10 pi. We
were calling it just expecting it to do the right thing for us.

> Looks like there are several places where that's done. In that case I
> wonder if we should have explicit scsi_in_transfer_length() and
> scsi_out_transfer_length() wrappers?

Yeah, maybe.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html