Skip to content

Commit 6a24dfb

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
SUNRPC: Pass pointers to struct rpc_xprt to the congestion window
Avoid access to task->tk_xprt Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent 3dc0da2 commit 6a24dfb

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎include/linux/sunrpc/xprt.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ struct rpc_xprt_ops {
122122
void (*buf_free)(void *buffer);
123123
int (*send_request)(struct rpc_task *task);
124124
void (*set_retrans_timeout)(struct rpc_task *task);
125-
void (*timer)(struct rpc_task *task);
125+
void (*timer)(struct rpc_xprt *xprt, struct rpc_task *task);
126126
void (*release_request)(struct rpc_task *task);
127127
void (*close)(struct rpc_xprt *xprt);
128128
void (*destroy)(struct rpc_xprt *xprt);
@@ -313,7 +313,7 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
313313
void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
314314
void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action);
315315
void xprt_write_space(struct rpc_xprt *xprt);
316-
void xprt_adjust_cwnd(struct rpc_task *task, int result);
316+
void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result);
317317
struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
318318
void xprt_complete_rqst(struct rpc_task *task, int copied);
319319
void xprt_release_rqst_cong(struct rpc_task *task);

‎net/sunrpc/xprt.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,15 +438,15 @@ EXPORT_SYMBOL_GPL(xprt_release_rqst_cong);
438438

439439
/**
440440
* xprt_adjust_cwnd - adjust transport congestion window
441+
* @xprt: pointer to xprt
441442
* @task: recently completed RPC request used to adjust window
442443
* @result: result code of completed RPC request
443444
*
444445
* We use a time-smoothed congestion estimator to avoid heavy oscillation.
445446
*/
446-
void xprt_adjust_cwnd(struct rpc_task *task, int result)
447+
void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result)
447448
{
448449
struct rpc_rqst *req = task->tk_rqstp;
449-
struct rpc_xprt *xprt = task->tk_xprt;
450450
unsigned long cwnd = xprt->cwnd;
451451

452452
if (result >= 0 && cwnd <= xprt->cong) {
@@ -834,7 +834,7 @@ static void xprt_timer(struct rpc_task *task)
834834
spin_lock_bh(&xprt->transport_lock);
835835
if (!req->rq_reply_bytes_recvd) {
836836
if (xprt->ops->timer)
837-
xprt->ops->timer(task);
837+
xprt->ops->timer(xprt, task);
838838
} else
839839
task->tk_status = 0;
840840
spin_unlock_bh(&xprt->transport_lock);

‎net/sunrpc/xprtsock.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ static void xs_udp_data_ready(struct sock *sk, int len)
10051005

10061006
UDPX_INC_STATS_BH(sk, UDP_MIB_INDATAGRAMS);
10071007

1008-
xprt_adjust_cwnd(task, copied);
1008+
xprt_adjust_cwnd(xprt, task, copied);
10091009
xprt_complete_rqst(task, copied);
10101010

10111011
out_unlock:
@@ -1646,9 +1646,9 @@ static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t
16461646
*
16471647
* Adjust the congestion window after a retransmit timeout has occurred.
16481648
*/
1649-
static void xs_udp_timer(struct rpc_task *task)
1649+
static void xs_udp_timer(struct rpc_xprt *xprt, struct rpc_task *task)
16501650
{
1651-
xprt_adjust_cwnd(task, -ETIMEDOUT);
1651+
xprt_adjust_cwnd(xprt, task, -ETIMEDOUT);
16521652
}
16531653

16541654
static unsigned short xs_get_random_port(void)

0 commit comments

Comments
 (0)