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>
This commit is contained in:
Trond Myklebust 2013-01-08 09:48:15 -05:00
Родитель 3dc0da278e
Коммит 6a24dfb645
3 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -122,7 +122,7 @@ struct rpc_xprt_ops {
void (*buf_free)(void *buffer); void (*buf_free)(void *buffer);
int (*send_request)(struct rpc_task *task); int (*send_request)(struct rpc_task *task);
void (*set_retrans_timeout)(struct rpc_task *task); void (*set_retrans_timeout)(struct rpc_task *task);
void (*timer)(struct rpc_task *task); void (*timer)(struct rpc_xprt *xprt, struct rpc_task *task);
void (*release_request)(struct rpc_task *task); void (*release_request)(struct rpc_task *task);
void (*close)(struct rpc_xprt *xprt); void (*close)(struct rpc_xprt *xprt);
void (*destroy)(struct rpc_xprt *xprt); void (*destroy)(struct rpc_xprt *xprt);
@ -313,7 +313,7 @@ void xprt_set_retrans_timeout_rtt(struct rpc_task *task);
void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status);
void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action); void xprt_wait_for_buffer_space(struct rpc_task *task, rpc_action action);
void xprt_write_space(struct rpc_xprt *xprt); void xprt_write_space(struct rpc_xprt *xprt);
void xprt_adjust_cwnd(struct rpc_task *task, int result); void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result);
struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid); struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, __be32 xid);
void xprt_complete_rqst(struct rpc_task *task, int copied); void xprt_complete_rqst(struct rpc_task *task, int copied);
void xprt_release_rqst_cong(struct rpc_task *task); void xprt_release_rqst_cong(struct rpc_task *task);

Просмотреть файл

@ -438,15 +438,15 @@ EXPORT_SYMBOL_GPL(xprt_release_rqst_cong);
/** /**
* xprt_adjust_cwnd - adjust transport congestion window * xprt_adjust_cwnd - adjust transport congestion window
* @xprt: pointer to xprt
* @task: recently completed RPC request used to adjust window * @task: recently completed RPC request used to adjust window
* @result: result code of completed RPC request * @result: result code of completed RPC request
* *
* We use a time-smoothed congestion estimator to avoid heavy oscillation. * We use a time-smoothed congestion estimator to avoid heavy oscillation.
*/ */
void xprt_adjust_cwnd(struct rpc_task *task, int result) void xprt_adjust_cwnd(struct rpc_xprt *xprt, struct rpc_task *task, int result)
{ {
struct rpc_rqst *req = task->tk_rqstp; struct rpc_rqst *req = task->tk_rqstp;
struct rpc_xprt *xprt = task->tk_xprt;
unsigned long cwnd = xprt->cwnd; unsigned long cwnd = xprt->cwnd;
if (result >= 0 && cwnd <= xprt->cong) { if (result >= 0 && cwnd <= xprt->cong) {
@ -834,7 +834,7 @@ static void xprt_timer(struct rpc_task *task)
spin_lock_bh(&xprt->transport_lock); spin_lock_bh(&xprt->transport_lock);
if (!req->rq_reply_bytes_recvd) { if (!req->rq_reply_bytes_recvd) {
if (xprt->ops->timer) if (xprt->ops->timer)
xprt->ops->timer(task); xprt->ops->timer(xprt, task);
} else } else
task->tk_status = 0; task->tk_status = 0;
spin_unlock_bh(&xprt->transport_lock); spin_unlock_bh(&xprt->transport_lock);

Просмотреть файл

@ -1005,7 +1005,7 @@ static void xs_udp_data_ready(struct sock *sk, int len)
UDPX_INC_STATS_BH(sk, UDP_MIB_INDATAGRAMS); UDPX_INC_STATS_BH(sk, UDP_MIB_INDATAGRAMS);
xprt_adjust_cwnd(task, copied); xprt_adjust_cwnd(xprt, task, copied);
xprt_complete_rqst(task, copied); xprt_complete_rqst(task, copied);
out_unlock: out_unlock:
@ -1646,9 +1646,9 @@ static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t
* *
* Adjust the congestion window after a retransmit timeout has occurred. * Adjust the congestion window after a retransmit timeout has occurred.
*/ */
static void xs_udp_timer(struct rpc_task *task) static void xs_udp_timer(struct rpc_xprt *xprt, struct rpc_task *task)
{ {
xprt_adjust_cwnd(task, -ETIMEDOUT); xprt_adjust_cwnd(xprt, task, -ETIMEDOUT);
} }
static unsigned short xs_get_random_port(void) static unsigned short xs_get_random_port(void)