Re: [PATCH v2 3/4] IB/srp: Fix residual handling

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

 



On Wed, 2014-07-09 at 15:57 +0200, Bart Van Assche wrote:
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -1644,10 +1644,14 @@ static void srp_process_rsp(struct srp_target_port *target, struct srp_rsp *rsp)
>  				     SCSI_SENSE_BUFFERSIZE));
>  		}
 
Above this block, there is a line 
	if (rsp->flags & SRP_RSP_FLAG_SNSVALID) {

My thought was that you could wrap the code starting at that block and
ending after the additional scsi_set_resid() calls you added with an
outer test like so:

	if (unlikely(rsp->flags & ~SRP_RSP_FLAG_RSPVALID)) {
		if (rsp->flags & SRP_RSP_FLAG_SNSVALID) {
			...

instead of adding unlikely() to each test of flags. Once inside the
block -- which should be rare -- we're on the slow path anyway.

Your call.

> -		if (rsp->flags & (SRP_RSP_FLAG_DOOVER | SRP_RSP_FLAG_DOUNDER))
> -			scsi_set_resid(scmnd, be32_to_cpu(rsp->data_out_res_cnt));
> -		else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER))
> +		if (unlikely(rsp->flags & SRP_RSP_FLAG_DIUNDER))
>  			scsi_set_resid(scmnd, be32_to_cpu(rsp->data_in_res_cnt));
> +		else if (unlikely(rsp->flags & SRP_RSP_FLAG_DIOVER))
> +			scsi_set_resid(scmnd, -be32_to_cpu(rsp->data_in_res_cnt));
> +		else if (unlikely(rsp->flags & SRP_RSP_FLAG_DOUNDER))
> +			scsi_set_resid(scmnd, be32_to_cpu(rsp->data_out_res_cnt));
> +		else if (unlikely(rsp->flags & SRP_RSP_FLAG_DOOVER))
> +			scsi_set_resid(scmnd, -be32_to_cpu(rsp->data_out_res_cnt));
>  
>  		srp_free_req(target, req, scmnd,
>  			     be32_to_cpu(rsp->req_lim_delta));


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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux