aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtrdma/fmr_ops.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2015-03-30 14:35:17 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2015-03-31 09:52:53 -0400
commit4561f347d49c645fd81d1f47b0fb460e8a6e4587 (patch)
tree139bf80af59a649e011c21f915d60ad2941850ef /net/sunrpc/xprtrdma/fmr_ops.c
parent31a701a94751509bb72e13d851f18ddcf22ff722 (diff)
xprtrdma: Add "destroy MRs" memreg op
Memory Region objects associated with a transport instance are destroyed before the instance is shutdown and destroyed. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Tested-by: Devesh Sharma <Devesh.Sharma@Emulex.Com> Tested-by: Meghana Cheripady <Meghana.Cheripady@Emulex.Com> Tested-by: Veeresh U. Kokatnur <veereshuk@chelsio.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc/xprtrdma/fmr_ops.c')
-rw-r--r--net/sunrpc/xprtrdma/fmr_ops.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/net/sunrpc/xprtrdma/fmr_ops.c b/net/sunrpc/xprtrdma/fmr_ops.c
index 93261b05891e..e9ca5944ac1e 100644
--- a/net/sunrpc/xprtrdma/fmr_ops.c
+++ b/net/sunrpc/xprtrdma/fmr_ops.c
@@ -168,11 +168,29 @@ fmr_op_reset(struct rpcrdma_xprt *r_xprt)
168 __func__, rc); 168 __func__, rc);
169} 169}
170 170
171static void
172fmr_op_destroy(struct rpcrdma_buffer *buf)
173{
174 struct rpcrdma_mw *r;
175 int rc;
176
177 while (!list_empty(&buf->rb_all)) {
178 r = list_entry(buf->rb_all.next, struct rpcrdma_mw, mw_all);
179 list_del(&r->mw_all);
180 rc = ib_dealloc_fmr(r->r.fmr);
181 if (rc)
182 dprintk("RPC: %s: ib_dealloc_fmr failed %i\n",
183 __func__, rc);
184 kfree(r);
185 }
186}
187
171const struct rpcrdma_memreg_ops rpcrdma_fmr_memreg_ops = { 188const struct rpcrdma_memreg_ops rpcrdma_fmr_memreg_ops = {
172 .ro_map = fmr_op_map, 189 .ro_map = fmr_op_map,
173 .ro_unmap = fmr_op_unmap, 190 .ro_unmap = fmr_op_unmap,
174 .ro_maxpages = fmr_op_maxpages, 191 .ro_maxpages = fmr_op_maxpages,
175 .ro_init = fmr_op_init, 192 .ro_init = fmr_op_init,
176 .ro_reset = fmr_op_reset, 193 .ro_reset = fmr_op_reset,
194 .ro_destroy = fmr_op_destroy,
177 .ro_displayname = "fmr", 195 .ro_displayname = "fmr",
178}; 196};