Skip to content

Commit 13650c2

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Eliminate "ia" argument in rpcrdma_{alloc, free}_regbuf
Clean up. The "ia" argument is no longer used. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent 54cbd6b commit 13650c2

File tree

4 files changed

+23
-31
lines changed

4 files changed

+23
-31
lines changed

net/sunrpc/xprtrdma/backchannel.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ static void rpcrdma_bc_free_rqst(struct rpcrdma_xprt *r_xprt,
2727
list_del(&req->rl_all);
2828
spin_unlock(&buf->rb_reqslock);
2929

30-
rpcrdma_destroy_req(&r_xprt->rx_ia, req);
30+
rpcrdma_destroy_req(req);
3131

3232
kfree(rqst);
3333
}
3434

3535
static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt,
3636
struct rpc_rqst *rqst)
3737
{
38-
struct rpcrdma_ia *ia = &r_xprt->rx_ia;
3938
struct rpcrdma_regbuf *rb;
4039
struct rpcrdma_req *req;
4140
size_t size;
@@ -45,14 +44,14 @@ static int rpcrdma_bc_setup_rqst(struct rpcrdma_xprt *r_xprt,
4544
return PTR_ERR(req);
4645
req->rl_backchannel = true;
4746

48-
rb = rpcrdma_alloc_regbuf(ia, RPCRDMA_HDRBUF_SIZE,
47+
rb = rpcrdma_alloc_regbuf(RPCRDMA_HDRBUF_SIZE,
4948
DMA_TO_DEVICE, GFP_KERNEL);
5049
if (IS_ERR(rb))
5150
goto out_fail;
5251
req->rl_rdmabuf = rb;
5352

5453
size = r_xprt->rx_data.inline_rsize;
55-
rb = rpcrdma_alloc_regbuf(ia, size, DMA_TO_DEVICE, GFP_KERNEL);
54+
rb = rpcrdma_alloc_regbuf(size, DMA_TO_DEVICE, GFP_KERNEL);
5655
if (IS_ERR(rb))
5756
goto out_fail;
5857
req->rl_sendbuf = rb;

net/sunrpc/xprtrdma/transport.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ rpcrdma_get_rdmabuf(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req,
490490
if (req->rl_rdmabuf)
491491
return true;
492492

493-
rb = rpcrdma_alloc_regbuf(&r_xprt->rx_ia, size, DMA_TO_DEVICE, flags);
493+
rb = rpcrdma_alloc_regbuf(size, DMA_TO_DEVICE, flags);
494494
if (IS_ERR(rb))
495495
return false;
496496

@@ -517,12 +517,11 @@ rpcrdma_get_sendbuf(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req,
517517
return true;
518518

519519
min_size = max_t(size_t, size, r_xprt->rx_data.inline_wsize);
520-
rb = rpcrdma_alloc_regbuf(&r_xprt->rx_ia, min_size,
521-
DMA_TO_DEVICE, flags);
520+
rb = rpcrdma_alloc_regbuf(min_size, DMA_TO_DEVICE, flags);
522521
if (IS_ERR(rb))
523522
return false;
524523

525-
rpcrdma_free_regbuf(&r_xprt->rx_ia, req->rl_sendbuf);
524+
rpcrdma_free_regbuf(req->rl_sendbuf);
526525
r_xprt->rx_stats.hardway_register_count += min_size;
527526
req->rl_sendbuf = rb;
528527
return true;
@@ -548,11 +547,11 @@ rpcrdma_get_recvbuf(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req,
548547
if (req->rl_recvbuf && rdmab_length(req->rl_recvbuf) >= size)
549548
return true;
550549

551-
rb = rpcrdma_alloc_regbuf(&r_xprt->rx_ia, size, DMA_NONE, flags);
550+
rb = rpcrdma_alloc_regbuf(size, DMA_NONE, flags);
552551
if (IS_ERR(rb))
553552
return false;
554553

555-
rpcrdma_free_regbuf(&r_xprt->rx_ia, req->rl_recvbuf);
554+
rpcrdma_free_regbuf(req->rl_recvbuf);
556555
r_xprt->rx_stats.hardway_register_count += size;
557556
req->rl_recvbuf = rb;
558557
return true;

net/sunrpc/xprtrdma/verbs.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ rpcrdma_create_rep(struct rpcrdma_xprt *r_xprt)
865865
if (rep == NULL)
866866
goto out;
867867

868-
rep->rr_rdmabuf = rpcrdma_alloc_regbuf(ia, cdata->inline_rsize,
868+
rep->rr_rdmabuf = rpcrdma_alloc_regbuf(cdata->inline_rsize,
869869
DMA_FROM_DEVICE, GFP_KERNEL);
870870
if (IS_ERR(rep->rr_rdmabuf)) {
871871
rc = PTR_ERR(rep->rr_rdmabuf);
@@ -966,18 +966,18 @@ rpcrdma_buffer_get_rep_locked(struct rpcrdma_buffer *buf)
966966
}
967967

968968
static void
969-
rpcrdma_destroy_rep(struct rpcrdma_ia *ia, struct rpcrdma_rep *rep)
969+
rpcrdma_destroy_rep(struct rpcrdma_rep *rep)
970970
{
971-
rpcrdma_free_regbuf(ia, rep->rr_rdmabuf);
971+
rpcrdma_free_regbuf(rep->rr_rdmabuf);
972972
kfree(rep);
973973
}
974974

975975
void
976-
rpcrdma_destroy_req(struct rpcrdma_ia *ia, struct rpcrdma_req *req)
976+
rpcrdma_destroy_req(struct rpcrdma_req *req)
977977
{
978-
rpcrdma_free_regbuf(ia, req->rl_recvbuf);
979-
rpcrdma_free_regbuf(ia, req->rl_sendbuf);
980-
rpcrdma_free_regbuf(ia, req->rl_rdmabuf);
978+
rpcrdma_free_regbuf(req->rl_recvbuf);
979+
rpcrdma_free_regbuf(req->rl_sendbuf);
980+
rpcrdma_free_regbuf(req->rl_rdmabuf);
981981
kfree(req);
982982
}
983983

@@ -1010,15 +1010,13 @@ rpcrdma_destroy_mrs(struct rpcrdma_buffer *buf)
10101010
void
10111011
rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf)
10121012
{
1013-
struct rpcrdma_ia *ia = rdmab_to_ia(buf);
1014-
10151013
cancel_delayed_work_sync(&buf->rb_recovery_worker);
10161014

10171015
while (!list_empty(&buf->rb_recv_bufs)) {
10181016
struct rpcrdma_rep *rep;
10191017

10201018
rep = rpcrdma_buffer_get_rep_locked(buf);
1021-
rpcrdma_destroy_rep(ia, rep);
1019+
rpcrdma_destroy_rep(rep);
10221020
}
10231021
buf->rb_send_count = 0;
10241022

@@ -1031,7 +1029,7 @@ rpcrdma_buffer_destroy(struct rpcrdma_buffer *buf)
10311029
list_del(&req->rl_all);
10321030

10331031
spin_unlock(&buf->rb_reqslock);
1034-
rpcrdma_destroy_req(ia, req);
1032+
rpcrdma_destroy_req(req);
10351033
spin_lock(&buf->rb_reqslock);
10361034
}
10371035
spin_unlock(&buf->rb_reqslock);
@@ -1174,7 +1172,6 @@ rpcrdma_recv_buffer_put(struct rpcrdma_rep *rep)
11741172

11751173
/**
11761174
* rpcrdma_alloc_regbuf - allocate and DMA-map memory for SEND/RECV buffers
1177-
* @ia: controlling rpcrdma_ia
11781175
* @size: size of buffer to be allocated, in bytes
11791176
* @direction: direction of data movement
11801177
* @flags: GFP flags
@@ -1187,8 +1184,8 @@ rpcrdma_recv_buffer_put(struct rpcrdma_rep *rep)
11871184
* or Replies they may be registered externally via ro_map.
11881185
*/
11891186
struct rpcrdma_regbuf *
1190-
rpcrdma_alloc_regbuf(struct rpcrdma_ia *ia, size_t size,
1191-
enum dma_data_direction direction, gfp_t flags)
1187+
rpcrdma_alloc_regbuf(size_t size, enum dma_data_direction direction,
1188+
gfp_t flags)
11921189
{
11931190
struct rpcrdma_regbuf *rb;
11941191

@@ -1239,11 +1236,10 @@ rpcrdma_dma_unmap_regbuf(struct rpcrdma_regbuf *rb)
12391236

12401237
/**
12411238
* rpcrdma_free_regbuf - deregister and free registered buffer
1242-
* @ia: controlling rpcrdma_ia
12431239
* @rb: regbuf to be deregistered and freed
12441240
*/
12451241
void
1246-
rpcrdma_free_regbuf(struct rpcrdma_ia *ia, struct rpcrdma_regbuf *rb)
1242+
rpcrdma_free_regbuf(struct rpcrdma_regbuf *rb)
12471243
{
12481244
if (!rb)
12491245
return;

net/sunrpc/xprtrdma/xprt_rdma.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ int rpcrdma_ep_post_recv(struct rpcrdma_ia *, struct rpcrdma_ep *,
465465
*/
466466
struct rpcrdma_req *rpcrdma_create_req(struct rpcrdma_xprt *);
467467
struct rpcrdma_rep *rpcrdma_create_rep(struct rpcrdma_xprt *);
468-
void rpcrdma_destroy_req(struct rpcrdma_ia *, struct rpcrdma_req *);
468+
void rpcrdma_destroy_req(struct rpcrdma_req *);
469469
int rpcrdma_buffer_create(struct rpcrdma_xprt *);
470470
void rpcrdma_buffer_destroy(struct rpcrdma_buffer *);
471471

@@ -478,12 +478,10 @@ void rpcrdma_recv_buffer_put(struct rpcrdma_rep *);
478478

479479
void rpcrdma_defer_mr_recovery(struct rpcrdma_mw *);
480480

481-
struct rpcrdma_regbuf *rpcrdma_alloc_regbuf(struct rpcrdma_ia *,
482-
size_t, enum dma_data_direction,
481+
struct rpcrdma_regbuf *rpcrdma_alloc_regbuf(size_t, enum dma_data_direction,
483482
gfp_t);
484483
bool __rpcrdma_dma_map_regbuf(struct rpcrdma_ia *, struct rpcrdma_regbuf *);
485-
void rpcrdma_free_regbuf(struct rpcrdma_ia *,
486-
struct rpcrdma_regbuf *);
484+
void rpcrdma_free_regbuf(struct rpcrdma_regbuf *);
487485

488486
static inline bool
489487
rpcrdma_regbuf_is_mapped(struct rpcrdma_regbuf *rb)

0 commit comments

Comments
 (0)