aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-17 18:11:34 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-17 18:11:34 -0400
commit34006cee28f7344f9557a4be3816c7891b1bbab1 (patch)
tree2b0ddaa661a7dcb4715948b965ee307614b232f1 /net/sunrpc
parent3b27bad7f7ceacca6d6c0ef647ffb38aa55a8336 (diff)
SUNRPC: Replace xprt->resend and xprt->sending with a priority queue
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xprt.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index be85cf04a479..9b6a4d1ea8f8 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -195,6 +195,7 @@ EXPORT_SYMBOL_GPL(xprt_load_transport);
195int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task) 195int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
196{ 196{
197 struct rpc_rqst *req = task->tk_rqstp; 197 struct rpc_rqst *req = task->tk_rqstp;
198 int priority;
198 199
199 if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) { 200 if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) {
200 if (task == xprt->snd_task) 201 if (task == xprt->snd_task)
@@ -214,10 +215,13 @@ out_sleep:
214 task->tk_pid, xprt); 215 task->tk_pid, xprt);
215 task->tk_timeout = 0; 216 task->tk_timeout = 0;
216 task->tk_status = -EAGAIN; 217 task->tk_status = -EAGAIN;
217 if (req != NULL && req->rq_ntrans) 218 if (req == NULL)
218 rpc_sleep_on(&xprt->resend, task, NULL); 219 priority = RPC_PRIORITY_LOW;
220 else if (!req->rq_ntrans)
221 priority = RPC_PRIORITY_NORMAL;
219 else 222 else
220 rpc_sleep_on(&xprt->sending, task, NULL); 223 priority = RPC_PRIORITY_HIGH;
224 rpc_sleep_on_priority(&xprt->sending, task, NULL, priority);
221 return 0; 225 return 0;
222} 226}
223EXPORT_SYMBOL_GPL(xprt_reserve_xprt); 227EXPORT_SYMBOL_GPL(xprt_reserve_xprt);
@@ -244,6 +248,7 @@ static void xprt_clear_locked(struct rpc_xprt *xprt)
244int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task) 248int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task)
245{ 249{
246 struct rpc_rqst *req = task->tk_rqstp; 250 struct rpc_rqst *req = task->tk_rqstp;
251 int priority;
247 252
248 if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) { 253 if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) {
249 if (task == xprt->snd_task) 254 if (task == xprt->snd_task)
@@ -265,10 +270,13 @@ out_sleep:
265 dprintk("RPC: %5u failed to lock transport %p\n", task->tk_pid, xprt); 270 dprintk("RPC: %5u failed to lock transport %p\n", task->tk_pid, xprt);
266 task->tk_timeout = 0; 271 task->tk_timeout = 0;
267 task->tk_status = -EAGAIN; 272 task->tk_status = -EAGAIN;
268 if (req != NULL && req->rq_ntrans) 273 if (req == NULL)
269 rpc_sleep_on(&xprt->resend, task, NULL); 274 priority = RPC_PRIORITY_LOW;
275 else if (!req->rq_ntrans)
276 priority = RPC_PRIORITY_NORMAL;
270 else 277 else
271 rpc_sleep_on(&xprt->sending, task, NULL); 278 priority = RPC_PRIORITY_HIGH;
279 rpc_sleep_on_priority(&xprt->sending, task, NULL, priority);
272 return 0; 280 return 0;
273} 281}
274EXPORT_SYMBOL_GPL(xprt_reserve_xprt_cong); 282EXPORT_SYMBOL_GPL(xprt_reserve_xprt_cong);
@@ -291,12 +299,9 @@ static void __xprt_lock_write_next(struct rpc_xprt *xprt)
291 if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) 299 if (test_and_set_bit(XPRT_LOCKED, &xprt->state))
292 return; 300 return;
293 301
294 task = rpc_wake_up_next(&xprt->resend); 302 task = rpc_wake_up_next(&xprt->sending);
295 if (!task) { 303 if (task == NULL)
296 task = rpc_wake_up_next(&xprt->sending); 304 goto out_unlock;
297 if (task == NULL)
298 goto out_unlock;
299 }
300 305
301 req = task->tk_rqstp; 306 req = task->tk_rqstp;
302 xprt->snd_task = task; 307 xprt->snd_task = task;
@@ -319,12 +324,9 @@ static void __xprt_lock_write_next_cong(struct rpc_xprt *xprt)
319 return; 324 return;
320 if (RPCXPRT_CONGESTED(xprt)) 325 if (RPCXPRT_CONGESTED(xprt))
321 goto out_unlock; 326 goto out_unlock;
322 task = rpc_wake_up_next(&xprt->resend); 327 task = rpc_wake_up_next(&xprt->sending);
323 if (!task) { 328 if (task == NULL)
324 task = rpc_wake_up_next(&xprt->sending); 329 goto out_unlock;
325 if (task == NULL)
326 goto out_unlock;
327 }
328 330
329 req = task->tk_rqstp; 331 req = task->tk_rqstp;
330 if (req == NULL) { 332 if (req == NULL) {
@@ -1177,8 +1179,7 @@ static void xprt_init(struct rpc_xprt *xprt, struct net *net)
1177 1179
1178 rpc_init_wait_queue(&xprt->binding, "xprt_binding"); 1180 rpc_init_wait_queue(&xprt->binding, "xprt_binding");
1179 rpc_init_wait_queue(&xprt->pending, "xprt_pending"); 1181 rpc_init_wait_queue(&xprt->pending, "xprt_pending");
1180 rpc_init_wait_queue(&xprt->sending, "xprt_sending"); 1182 rpc_init_priority_wait_queue(&xprt->sending, "xprt_sending");
1181 rpc_init_wait_queue(&xprt->resend, "xprt_resend");
1182 rpc_init_priority_wait_queue(&xprt->backlog, "xprt_backlog"); 1183 rpc_init_priority_wait_queue(&xprt->backlog, "xprt_backlog");
1183 1184
1184 xprt_init_xid(xprt); 1185 xprt_init_xid(xprt);
@@ -1240,7 +1241,6 @@ static void xprt_destroy(struct rpc_xprt *xprt)
1240 rpc_destroy_wait_queue(&xprt->binding); 1241 rpc_destroy_wait_queue(&xprt->binding);
1241 rpc_destroy_wait_queue(&xprt->pending); 1242 rpc_destroy_wait_queue(&xprt->pending);
1242 rpc_destroy_wait_queue(&xprt->sending); 1243 rpc_destroy_wait_queue(&xprt->sending);
1243 rpc_destroy_wait_queue(&xprt->resend);
1244 rpc_destroy_wait_queue(&xprt->backlog); 1244 rpc_destroy_wait_queue(&xprt->backlog);
1245 cancel_work_sync(&xprt->task_cleanup); 1245 cancel_work_sync(&xprt->task_cleanup);
1246 /* 1246 /*