summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2019-08-19 18:44:50 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-08-20 16:11:56 -0400
commit1ca3f4c054a4e3765bdeb62c849d940b5bc8002d (patch)
treeada2bb80c0efb99a3ea6dc946b64010fb9113f21
parent265a38d4611360ae3d5bb612d586a3126507a954 (diff)
xprtrdma: Combine rpcrdma_mr_put and rpcrdma_mr_unmap_and_put
Clean up. There is only one remaining rpcrdma_mr_put call site, and it can be directly replaced with unmap_and_put because mr->mr_dir is set to DMA_NONE just before the call. Now all the call sites do a DMA unmap, and we can just rename mr_unmap_and_put to mr_put, which nicely matches mr_get. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r--net/sunrpc/xprtrdma/frwr_ops.c6
-rw-r--r--net/sunrpc/xprtrdma/verbs.c32
-rw-r--r--net/sunrpc/xprtrdma/xprt_rdma.h1
3 files changed, 11 insertions, 28 deletions
diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
index d7e763fafa04..97e1804139b8 100644
--- a/net/sunrpc/xprtrdma/frwr_ops.c
+++ b/net/sunrpc/xprtrdma/frwr_ops.c
@@ -129,7 +129,7 @@ void frwr_reset(struct rpcrdma_req *req)
129 struct rpcrdma_mr *mr; 129 struct rpcrdma_mr *mr;
130 130
131 while ((mr = rpcrdma_mr_pop(&req->rl_registered))) 131 while ((mr = rpcrdma_mr_pop(&req->rl_registered)))
132 rpcrdma_mr_unmap_and_put(mr); 132 rpcrdma_mr_put(mr);
133} 133}
134 134
135/** 135/**
@@ -453,7 +453,7 @@ void frwr_reminv(struct rpcrdma_rep *rep, struct list_head *mrs)
453 if (mr->mr_handle == rep->rr_inv_rkey) { 453 if (mr->mr_handle == rep->rr_inv_rkey) {
454 list_del_init(&mr->mr_list); 454 list_del_init(&mr->mr_list);
455 trace_xprtrdma_mr_remoteinv(mr); 455 trace_xprtrdma_mr_remoteinv(mr);
456 rpcrdma_mr_unmap_and_put(mr); 456 rpcrdma_mr_put(mr);
457 break; /* only one invalidated MR per RPC */ 457 break; /* only one invalidated MR per RPC */
458 } 458 }
459} 459}
@@ -463,7 +463,7 @@ static void __frwr_release_mr(struct ib_wc *wc, struct rpcrdma_mr *mr)
463 if (wc->status != IB_WC_SUCCESS) 463 if (wc->status != IB_WC_SUCCESS)
464 rpcrdma_mr_recycle(mr); 464 rpcrdma_mr_recycle(mr);
465 else 465 else
466 rpcrdma_mr_unmap_and_put(mr); 466 rpcrdma_mr_put(mr);
467} 467}
468 468
469/** 469/**
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
index ee6fcf10425b..5e0b774ed522 100644
--- a/net/sunrpc/xprtrdma/verbs.c
+++ b/net/sunrpc/xprtrdma/verbs.c
@@ -1233,34 +1233,15 @@ out_nomrs:
1233 return NULL; 1233 return NULL;
1234} 1234}
1235 1235
1236static void
1237__rpcrdma_mr_put(struct rpcrdma_buffer *buf, struct rpcrdma_mr *mr)
1238{
1239 spin_lock(&buf->rb_mrlock);
1240 rpcrdma_mr_push(mr, &buf->rb_mrs);
1241 spin_unlock(&buf->rb_mrlock);
1242}
1243
1244/**
1245 * rpcrdma_mr_put - Release an rpcrdma_mr object
1246 * @mr: object to release
1247 *
1248 */
1249void
1250rpcrdma_mr_put(struct rpcrdma_mr *mr)
1251{
1252 __rpcrdma_mr_put(&mr->mr_xprt->rx_buf, mr);
1253}
1254
1255/** 1236/**
1256 * rpcrdma_mr_unmap_and_put - DMA unmap an MR and release it 1237 * rpcrdma_mr_put - DMA unmap an MR and release it
1257 * @mr: object to release 1238 * @mr: MR to release
1258 * 1239 *
1259 */ 1240 */
1260void 1241void rpcrdma_mr_put(struct rpcrdma_mr *mr)
1261rpcrdma_mr_unmap_and_put(struct rpcrdma_mr *mr)
1262{ 1242{
1263 struct rpcrdma_xprt *r_xprt = mr->mr_xprt; 1243 struct rpcrdma_xprt *r_xprt = mr->mr_xprt;
1244 struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
1264 1245
1265 if (mr->mr_dir != DMA_NONE) { 1246 if (mr->mr_dir != DMA_NONE) {
1266 trace_xprtrdma_mr_unmap(mr); 1247 trace_xprtrdma_mr_unmap(mr);
@@ -1268,7 +1249,10 @@ rpcrdma_mr_unmap_and_put(struct rpcrdma_mr *mr)
1268 mr->mr_sg, mr->mr_nents, mr->mr_dir); 1249 mr->mr_sg, mr->mr_nents, mr->mr_dir);
1269 mr->mr_dir = DMA_NONE; 1250 mr->mr_dir = DMA_NONE;
1270 } 1251 }
1271 __rpcrdma_mr_put(&r_xprt->rx_buf, mr); 1252
1253 spin_lock(&buf->rb_mrlock);
1254 rpcrdma_mr_push(mr, &buf->rb_mrs);
1255 spin_unlock(&buf->rb_mrlock);
1272} 1256}
1273 1257
1274/** 1258/**
diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h
index 9663b8ddd733..3e0839c2cda2 100644
--- a/net/sunrpc/xprtrdma/xprt_rdma.h
+++ b/net/sunrpc/xprtrdma/xprt_rdma.h
@@ -485,7 +485,6 @@ struct rpcrdma_sendctx *rpcrdma_sendctx_get_locked(struct rpcrdma_xprt *r_xprt);
485 485
486struct rpcrdma_mr *rpcrdma_mr_get(struct rpcrdma_xprt *r_xprt); 486struct rpcrdma_mr *rpcrdma_mr_get(struct rpcrdma_xprt *r_xprt);
487void rpcrdma_mr_put(struct rpcrdma_mr *mr); 487void rpcrdma_mr_put(struct rpcrdma_mr *mr);
488void rpcrdma_mr_unmap_and_put(struct rpcrdma_mr *mr);
489 488
490static inline void 489static inline void
491rpcrdma_mr_recycle(struct rpcrdma_mr *mr) 490rpcrdma_mr_recycle(struct rpcrdma_mr *mr)