diff mbox

[10/12] IB/srp: Remove !ch->target tests from the reconnect code

Message ID 5541EF62.8050107@sandisk.com (mailing list archive)
State Rejected
Headers show

Commit Message

Bart Van Assche April 30, 2015, 9:01 a.m. UTC
Remove the !ch->target tests from the reconnect code. These
tests are not needed: upon entry of srp_rport_reconnect()
it is guaranteed that all ch->target pointers are non-NULL.
None of the functions srp_new_cm_id(), srp_finish_req(),
srp_create_ch_ib() nor srp_connect_ch() modifies this pointer.
srp_free_ch_ib() is never called concurrently with
srp_rport_reconnect().

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Sagi Grimberg April 30, 2015, 10:19 a.m. UTC | #1
On 4/30/2015 12:01 PM, Bart Van Assche wrote:
> Remove the !ch->target tests from the reconnect code. These
> tests are not needed: upon entry of srp_rport_reconnect()
> it is guaranteed that all ch->target pointers are non-NULL.
> None of the functions srp_new_cm_id(), srp_finish_req(),
> srp_create_ch_ib() nor srp_connect_ch() modifies this pointer.
> srp_free_ch_ib() is never called concurrently with
> srp_rport_reconnect().
>
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
> ---
>   drivers/infiniband/ulp/srp/ib_srp.c | 6 ------
>   1 file changed, 6 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index a73eb1e5..400ef7a 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -1216,14 +1216,10 @@ static int srp_rport_reconnect(struct srp_rport *rport)
>   	 */
>   	for (i = 0; i < target->ch_count; i++) {
>   		ch = &target->ch[i];
> -		if (!ch->target)
> -			break;
>   		ret += srp_new_cm_id(ch);
>   	}
>   	for (i = 0; i < target->ch_count; i++) {
>   		ch = &target->ch[i];
> -		if (!ch->target)
> -			break;
>   		for (j = 0; j < target->req_ring_size; ++j) {
>   			struct srp_request *req = &ch->req_ring[j];
>
> @@ -1232,8 +1228,6 @@ static int srp_rport_reconnect(struct srp_rport *rport)
>   	}
>   	for (i = 0; i < target->ch_count; i++) {
>   		ch = &target->ch[i];
> -		if (!ch->target)
> -			break;
>   		/*
>   		 * Whether or not creating a new CM ID succeeded, create a new
>   		 * QP. This guarantees that all completion callback function
>

Looks good.

Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index a73eb1e5..400ef7a 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1216,14 +1216,10 @@  static int srp_rport_reconnect(struct srp_rport *rport)
 	 */
 	for (i = 0; i < target->ch_count; i++) {
 		ch = &target->ch[i];
-		if (!ch->target)
-			break;
 		ret += srp_new_cm_id(ch);
 	}
 	for (i = 0; i < target->ch_count; i++) {
 		ch = &target->ch[i];
-		if (!ch->target)
-			break;
 		for (j = 0; j < target->req_ring_size; ++j) {
 			struct srp_request *req = &ch->req_ring[j];
 
@@ -1232,8 +1228,6 @@  static int srp_rport_reconnect(struct srp_rport *rport)
 	}
 	for (i = 0; i < target->ch_count; i++) {
 		ch = &target->ch[i];
-		if (!ch->target)
-			break;
 		/*
 		 * Whether or not creating a new CM ID succeeded, create a new
 		 * QP. This guarantees that all completion callback function