Skip to content

Commit c35ca60

Browse files
chuckleverTrond Myklebust
authored andcommitted
xprtrdma: Delete rpcrdma_recv_buffer_put()
Clean up: The name recv_buffer_put() is a vestige of older code, and the function is just a wrapper for the newer rpcrdma_rep_put(). In most of the existing call sites, a pointer to the owning rpcrdma_buffer is already available. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 35d8b10 commit c35ca60

4 files changed

Lines changed: 14 additions & 20 deletions

File tree

‎net/sunrpc/xprtrdma/backchannel.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ void xprt_rdma_bc_destroy(struct rpc_xprt *xprt, unsigned int reqs)
155155
void xprt_rdma_bc_free_rqst(struct rpc_rqst *rqst)
156156
{
157157
struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
158+
struct rpcrdma_rep *rep = req->rl_reply;
158159
struct rpc_xprt *xprt = rqst->rq_xprt;
160+
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
159161

160-
rpcrdma_recv_buffer_put(req->rl_reply);
162+
rpcrdma_rep_put(&r_xprt->rx_buf, rep);
161163
req->rl_reply = NULL;
162164

163165
spin_lock(&xprt->bc_pa_lock);

‎net/sunrpc/xprtrdma/rpc_rdma.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep)
14371437

14381438
req = rpcr_to_rdmar(rqst);
14391439
if (unlikely(req->rl_reply))
1440-
rpcrdma_recv_buffer_put(req->rl_reply);
1440+
rpcrdma_rep_put(buf, req->rl_reply);
14411441
req->rl_reply = rep;
14421442
rep->rr_rqst = rqst;
14431443

@@ -1465,5 +1465,5 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep)
14651465
trace_xprtrdma_reply_short_err(rep);
14661466

14671467
out:
1468-
rpcrdma_recv_buffer_put(rep);
1468+
rpcrdma_rep_put(buf, rep);
14691469
}

‎net/sunrpc/xprtrdma/verbs.c‎

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ static void rpcrdma_sendctx_put_locked(struct rpcrdma_xprt *r_xprt,
8080
struct rpcrdma_sendctx *sc);
8181
static int rpcrdma_reqs_setup(struct rpcrdma_xprt *r_xprt);
8282
static void rpcrdma_reqs_reset(struct rpcrdma_xprt *r_xprt);
83-
static void rpcrdma_rep_put(struct rpcrdma_buffer *buf,
84-
struct rpcrdma_rep *rep);
8583
static void rpcrdma_rep_destroy(struct rpcrdma_rep *rep);
8684
static void rpcrdma_reps_unmap(struct rpcrdma_xprt *r_xprt);
8785
static void rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt);
@@ -1036,8 +1034,13 @@ static struct rpcrdma_rep *rpcrdma_rep_get_locked(struct rpcrdma_buffer *buf)
10361034
return llist_entry(node, struct rpcrdma_rep, rr_node);
10371035
}
10381036

1039-
static void rpcrdma_rep_put(struct rpcrdma_buffer *buf,
1040-
struct rpcrdma_rep *rep)
1037+
/**
1038+
* rpcrdma_rep_put - Release rpcrdma_rep back to free list
1039+
* @buf: buffer pool
1040+
* @rep: rep to release
1041+
*
1042+
*/
1043+
void rpcrdma_rep_put(struct rpcrdma_buffer *buf, struct rpcrdma_rep *rep)
10411044
{
10421045
llist_add(&rep->rr_node, &buf->rb_free_reps);
10431046
}
@@ -1252,17 +1255,6 @@ void rpcrdma_buffer_put(struct rpcrdma_buffer *buffers, struct rpcrdma_req *req)
12521255
spin_unlock(&buffers->rb_lock);
12531256
}
12541257

1255-
/**
1256-
* rpcrdma_recv_buffer_put - Release rpcrdma_rep back to free list
1257-
* @rep: rep to release
1258-
*
1259-
* Used after error conditions.
1260-
*/
1261-
void rpcrdma_recv_buffer_put(struct rpcrdma_rep *rep)
1262-
{
1263-
rpcrdma_rep_put(&rep->rr_rxprt->rx_buf, rep);
1264-
}
1265-
12661258
/* Returns a pointer to a rpcrdma_regbuf object, or NULL.
12671259
*
12681260
* xprtrdma uses a regbuf for posting an outgoing RDMA SEND, or for
@@ -1455,7 +1447,7 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, int needed, bool temp)
14551447

14561448
rep = container_of(wr, struct rpcrdma_rep, rr_recv_wr);
14571449
wr = wr->next;
1458-
rpcrdma_recv_buffer_put(rep);
1450+
rpcrdma_rep_put(buf, rep);
14591451
--count;
14601452
}
14611453
}

‎net/sunrpc/xprtrdma/xprt_rdma.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ void rpcrdma_mrs_refresh(struct rpcrdma_xprt *r_xprt);
481481
struct rpcrdma_req *rpcrdma_buffer_get(struct rpcrdma_buffer *);
482482
void rpcrdma_buffer_put(struct rpcrdma_buffer *buffers,
483483
struct rpcrdma_req *req);
484-
void rpcrdma_recv_buffer_put(struct rpcrdma_rep *);
484+
void rpcrdma_rep_put(struct rpcrdma_buffer *buf, struct rpcrdma_rep *rep);
485485

486486
bool rpcrdma_regbuf_realloc(struct rpcrdma_regbuf *rb, size_t size,
487487
gfp_t flags);

0 commit comments

Comments
 (0)