mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
SUNRPC: Replace xprt->resend and xprt->sending with a priority queue
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
3b27bad7f7
commit
34006cee28
2 changed files with 21 additions and 22 deletions
|
@ -165,7 +165,6 @@ struct rpc_xprt {
|
||||||
|
|
||||||
struct rpc_wait_queue binding; /* requests waiting on rpcbind */
|
struct rpc_wait_queue binding; /* requests waiting on rpcbind */
|
||||||
struct rpc_wait_queue sending; /* requests waiting to send */
|
struct rpc_wait_queue sending; /* requests waiting to send */
|
||||||
struct rpc_wait_queue resend; /* requests waiting to resend */
|
|
||||||
struct rpc_wait_queue pending; /* requests in flight */
|
struct rpc_wait_queue pending; /* requests in flight */
|
||||||
struct rpc_wait_queue backlog; /* waiting for slot */
|
struct rpc_wait_queue backlog; /* waiting for slot */
|
||||||
struct list_head free; /* free slots */
|
struct list_head free; /* free slots */
|
||||||
|
|
|
@ -195,6 +195,7 @@ EXPORT_SYMBOL_GPL(xprt_load_transport);
|
||||||
int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
|
int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
|
||||||
{
|
{
|
||||||
struct rpc_rqst *req = task->tk_rqstp;
|
struct rpc_rqst *req = task->tk_rqstp;
|
||||||
|
int priority;
|
||||||
|
|
||||||
if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) {
|
if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) {
|
||||||
if (task == xprt->snd_task)
|
if (task == xprt->snd_task)
|
||||||
|
@ -214,10 +215,13 @@ int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
|
||||||
task->tk_pid, xprt);
|
task->tk_pid, xprt);
|
||||||
task->tk_timeout = 0;
|
task->tk_timeout = 0;
|
||||||
task->tk_status = -EAGAIN;
|
task->tk_status = -EAGAIN;
|
||||||
if (req != NULL && req->rq_ntrans)
|
if (req == NULL)
|
||||||
rpc_sleep_on(&xprt->resend, task, NULL);
|
priority = RPC_PRIORITY_LOW;
|
||||||
|
else if (!req->rq_ntrans)
|
||||||
|
priority = RPC_PRIORITY_NORMAL;
|
||||||
else
|
else
|
||||||
rpc_sleep_on(&xprt->sending, task, NULL);
|
priority = RPC_PRIORITY_HIGH;
|
||||||
|
rpc_sleep_on_priority(&xprt->sending, task, NULL, priority);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(xprt_reserve_xprt);
|
EXPORT_SYMBOL_GPL(xprt_reserve_xprt);
|
||||||
|
@ -244,6 +248,7 @@ static void xprt_clear_locked(struct rpc_xprt *xprt)
|
||||||
int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task)
|
int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task)
|
||||||
{
|
{
|
||||||
struct rpc_rqst *req = task->tk_rqstp;
|
struct rpc_rqst *req = task->tk_rqstp;
|
||||||
|
int priority;
|
||||||
|
|
||||||
if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) {
|
if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) {
|
||||||
if (task == xprt->snd_task)
|
if (task == xprt->snd_task)
|
||||||
|
@ -265,10 +270,13 @@ int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task)
|
||||||
dprintk("RPC: %5u failed to lock transport %p\n", task->tk_pid, xprt);
|
dprintk("RPC: %5u failed to lock transport %p\n", task->tk_pid, xprt);
|
||||||
task->tk_timeout = 0;
|
task->tk_timeout = 0;
|
||||||
task->tk_status = -EAGAIN;
|
task->tk_status = -EAGAIN;
|
||||||
if (req != NULL && req->rq_ntrans)
|
if (req == NULL)
|
||||||
rpc_sleep_on(&xprt->resend, task, NULL);
|
priority = RPC_PRIORITY_LOW;
|
||||||
|
else if (!req->rq_ntrans)
|
||||||
|
priority = RPC_PRIORITY_NORMAL;
|
||||||
else
|
else
|
||||||
rpc_sleep_on(&xprt->sending, task, NULL);
|
priority = RPC_PRIORITY_HIGH;
|
||||||
|
rpc_sleep_on_priority(&xprt->sending, task, NULL, priority);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(xprt_reserve_xprt_cong);
|
EXPORT_SYMBOL_GPL(xprt_reserve_xprt_cong);
|
||||||
|
@ -291,12 +299,9 @@ static void __xprt_lock_write_next(struct rpc_xprt *xprt)
|
||||||
if (test_and_set_bit(XPRT_LOCKED, &xprt->state))
|
if (test_and_set_bit(XPRT_LOCKED, &xprt->state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
task = rpc_wake_up_next(&xprt->resend);
|
task = rpc_wake_up_next(&xprt->sending);
|
||||||
if (!task) {
|
if (task == NULL)
|
||||||
task = rpc_wake_up_next(&xprt->sending);
|
goto out_unlock;
|
||||||
if (task == NULL)
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
req = task->tk_rqstp;
|
req = task->tk_rqstp;
|
||||||
xprt->snd_task = task;
|
xprt->snd_task = task;
|
||||||
|
@ -319,12 +324,9 @@ static void __xprt_lock_write_next_cong(struct rpc_xprt *xprt)
|
||||||
return;
|
return;
|
||||||
if (RPCXPRT_CONGESTED(xprt))
|
if (RPCXPRT_CONGESTED(xprt))
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
task = rpc_wake_up_next(&xprt->resend);
|
task = rpc_wake_up_next(&xprt->sending);
|
||||||
if (!task) {
|
if (task == NULL)
|
||||||
task = rpc_wake_up_next(&xprt->sending);
|
goto out_unlock;
|
||||||
if (task == NULL)
|
|
||||||
goto out_unlock;
|
|
||||||
}
|
|
||||||
|
|
||||||
req = task->tk_rqstp;
|
req = task->tk_rqstp;
|
||||||
if (req == NULL) {
|
if (req == NULL) {
|
||||||
|
@ -1177,8 +1179,7 @@ static void xprt_init(struct rpc_xprt *xprt, struct net *net)
|
||||||
|
|
||||||
rpc_init_wait_queue(&xprt->binding, "xprt_binding");
|
rpc_init_wait_queue(&xprt->binding, "xprt_binding");
|
||||||
rpc_init_wait_queue(&xprt->pending, "xprt_pending");
|
rpc_init_wait_queue(&xprt->pending, "xprt_pending");
|
||||||
rpc_init_wait_queue(&xprt->sending, "xprt_sending");
|
rpc_init_priority_wait_queue(&xprt->sending, "xprt_sending");
|
||||||
rpc_init_wait_queue(&xprt->resend, "xprt_resend");
|
|
||||||
rpc_init_priority_wait_queue(&xprt->backlog, "xprt_backlog");
|
rpc_init_priority_wait_queue(&xprt->backlog, "xprt_backlog");
|
||||||
|
|
||||||
xprt_init_xid(xprt);
|
xprt_init_xid(xprt);
|
||||||
|
@ -1240,7 +1241,6 @@ static void xprt_destroy(struct rpc_xprt *xprt)
|
||||||
rpc_destroy_wait_queue(&xprt->binding);
|
rpc_destroy_wait_queue(&xprt->binding);
|
||||||
rpc_destroy_wait_queue(&xprt->pending);
|
rpc_destroy_wait_queue(&xprt->pending);
|
||||||
rpc_destroy_wait_queue(&xprt->sending);
|
rpc_destroy_wait_queue(&xprt->sending);
|
||||||
rpc_destroy_wait_queue(&xprt->resend);
|
|
||||||
rpc_destroy_wait_queue(&xprt->backlog);
|
rpc_destroy_wait_queue(&xprt->backlog);
|
||||||
cancel_work_sync(&xprt->task_cleanup);
|
cancel_work_sync(&xprt->task_cleanup);
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue