xprtrdma: Clean up SGE accounting in rpcrdma_prepare_msg_sges()
authorChuck Lever <chuck.lever@oracle.com>
Fri, 20 Oct 2017 14:47:39 +0000 (10:47 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 17 Nov 2017 18:47:55 +0000 (13:47 -0500)
Clean up. rpcrdma_prepare_hdr_sge() sets num_sge to one, then
rpcrdma_prepare_msg_sges() sets num_sge again to the count of SGEs
it added, plus one for the header SGE just mapped in
rpcrdma_prepare_hdr_sge(). This is confusing, and nails in an
assumption about when these functions are called.

Instead, maintain a running count that both functions can update
with just the number of SGEs they have added to the SGE array.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/rpc_rdma.c

index b8818c0..3c92558 100644 (file)
@@ -637,7 +637,7 @@ map_tail:
        }
 
 out:
-       req->rl_send_wr.num_sge = sge_no + 1;
+       req->rl_send_wr.num_sge += sge_no;
        return true;
 
 out_mapping_overflow: