summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/xprtrdma/physical_ops.c
diff options
context:
space:
mode:
authorChuck Lever2015-05-26 17:51:56 +0200
committerAnna Schumaker2015-06-12 19:10:36 +0200
commit89e0d11258e9a69d550fd4bfb4609e955bdd84ee (patch)
treec757bfd52ebc5cf3bc022ca2191976867d27b267 /net/sunrpc/xprtrdma/physical_ops.c
parentxprtrdma: Remove rr_func (diff)
downloadkernel-qcow2-linux-89e0d11258e9a69d550fd4bfb4609e955bdd84ee.tar.gz
kernel-qcow2-linux-89e0d11258e9a69d550fd4bfb4609e955bdd84ee.tar.xz
kernel-qcow2-linux-89e0d11258e9a69d550fd4bfb4609e955bdd84ee.zip
xprtrdma: Use ib_device pointer safely
The connect worker can replace ri_id, but prevents ri_id->device from changing during the lifetime of a transport instance. The old ID is kept around until a new ID is created and the ->device is confirmed to be the same. Cache a copy of ri_id->device in rpcrdma_ia and in rpcrdma_rep. The cached copy can be used safely in code that does not serialize with the connect worker. Other code can use it to save an extra address generation (one pointer dereference instead of two). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Reviewed-by: Steve Wise <swise@opengridcomputing.com> Tested-By: Devesh Sharma <devesh.sharma@avagotech.com> Reviewed-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc/xprtrdma/physical_ops.c')
-rw-r--r--net/sunrpc/xprtrdma/physical_ops.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/sunrpc/xprtrdma/physical_ops.c b/net/sunrpc/xprtrdma/physical_ops.c
index ba518af16787..da149e892858 100644
--- a/net/sunrpc/xprtrdma/physical_ops.c
+++ b/net/sunrpc/xprtrdma/physical_ops.c
@@ -50,8 +50,7 @@ physical_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg,
{
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
- rpcrdma_map_one(ia->ri_id->device, seg,
- rpcrdma_data_dir(writing));
+ rpcrdma_map_one(ia->ri_device, seg, rpcrdma_data_dir(writing));
seg->mr_rkey = ia->ri_bind_mem->rkey;
seg->mr_base = seg->mr_dma;
seg->mr_nsegs = 1;
@@ -65,10 +64,7 @@ physical_op_unmap(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg)
{
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
- read_lock(&ia->ri_qplock);
- rpcrdma_unmap_one(ia->ri_id->device, seg);
- read_unlock(&ia->ri_qplock);
-
+ rpcrdma_unmap_one(ia->ri_device, seg);
return 1;
}