xprtrdma: Replace rpcrdma_rep::rr_buffer with rr_rxprt
authorChuck Lever <chuck.lever@oracle.com>
Tue, 26 May 2015 15:51:37 +0000 (11:51 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 12 Jun 2015 17:10:36 +0000 (13:10 -0400)
Clean up: Instead of carrying a pointer to the buffer pool and
the rpc_xprt, carry a pointer to the controlling rpcrdma_xprt.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.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>
net/sunrpc/xprtrdma/rpc_rdma.c
net/sunrpc/xprtrdma/transport.c
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtrdma/xprt_rdma.h

index 2c53ea9e1b83dae01ebdd1aa22d256174dfbae08..98a3b959cd5a038ed87fbbb6fb8638953759d7a4 100644 (file)
@@ -732,8 +732,8 @@ rpcrdma_reply_handler(struct rpcrdma_rep *rep)
        struct rpcrdma_msg *headerp;
        struct rpcrdma_req *req;
        struct rpc_rqst *rqst;
-       struct rpc_xprt *xprt = rep->rr_xprt;
-       struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
+       struct rpcrdma_xprt *r_xprt = rep->rr_rxprt;
+       struct rpc_xprt *xprt = &r_xprt->rx_xprt;
        __be32 *iptr;
        int rdmalen, status;
        unsigned long cwnd;
index 54f23b1be98617d5c29fb482a221ad6ed1391876..ce95eb3595d02aa3a90012f24e325ef4f776f2f2 100644 (file)
@@ -617,12 +617,9 @@ xprt_rdma_send_request(struct rpc_task *task)
 
        if (req->rl_reply == NULL)              /* e.g. reconnection */
                rpcrdma_recv_buffer_get(req);
-
-       if (req->rl_reply) {
+       /* rpcrdma_recv_buffer_get may have set rl_reply, so check again */
+       if (req->rl_reply)
                req->rl_reply->rr_func = rpcrdma_reply_handler;
-               /* this need only be done once, but... */
-               req->rl_reply->rr_xprt = xprt;
-       }
 
        /* Must suppress retransmit to maintain credits */
        if (req->rl_connect_cookie == xprt->connect_cookie)
index 51900e6a2ab6bc7e97c4c05a6981717720a372e8..c55bfbcb5bff711b6db27340a702e48f98d2c6a4 100644 (file)
@@ -278,6 +278,7 @@ rpcrdma_recvcq_process_wc(struct ib_wc *wc, struct list_head *sched_list)
 {
        struct rpcrdma_rep *rep =
                        (struct rpcrdma_rep *)(unsigned long)wc->wr_id;
+       struct rpcrdma_ia *ia;
 
        /* WARNING: Only wr_id and status are reliable at this point */
        if (wc->status != IB_WC_SUCCESS)
@@ -290,8 +291,9 @@ rpcrdma_recvcq_process_wc(struct ib_wc *wc, struct list_head *sched_list)
        dprintk("RPC:       %s: rep %p opcode 'recv', length %u: success\n",
                __func__, rep, wc->byte_len);
 
+       ia = &rep->rr_rxprt->rx_ia;
        rep->rr_len = wc->byte_len;
-       ib_dma_sync_single_for_cpu(rdmab_to_ia(rep->rr_buffer)->ri_id->device,
+       ib_dma_sync_single_for_cpu(ia->ri_id->device,
                                   rdmab_addr(rep->rr_rdmabuf),
                                   rep->rr_len, DMA_FROM_DEVICE);
        prefetch(rdmab_to_msg(rep->rr_rdmabuf));
@@ -1053,7 +1055,7 @@ rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt)
                goto out_free;
        }
 
-       rep->rr_buffer = &r_xprt->rx_buf;
+       rep->rr_rxprt = r_xprt;
        return rep;
 
 out_free:
@@ -1423,7 +1425,7 @@ rpcrdma_recv_buffer_get(struct rpcrdma_req *req)
 void
 rpcrdma_recv_buffer_put(struct rpcrdma_rep *rep)
 {
-       struct rpcrdma_buffer *buffers = rep->rr_buffer;
+       struct rpcrdma_buffer *buffers = &rep->rr_rxprt->rx_buf;
        unsigned long flags;
 
        rep->rr_func = NULL;
index 78e0b8beaa363f4ea8a2e2c1073bf5d5c0a92b45..c3d57c0fd4a52a91975dd01bffdde2532b3675f0 100644 (file)
@@ -173,8 +173,7 @@ struct rpcrdma_buffer;
 
 struct rpcrdma_rep {
        unsigned int            rr_len;
-       struct rpcrdma_buffer   *rr_buffer;
-       struct rpc_xprt         *rr_xprt;
+       struct rpcrdma_xprt     *rr_rxprt;
        void                    (*rr_func)(struct rpcrdma_rep *);
        struct list_head        rr_list;
        struct rpcrdma_regbuf   *rr_rdmabuf;