Commit 34006cee28f7344f9557a4be3816c7891b1bbab1

Authored by Trond Myklebust
1 parent 3b27bad7f7

SUNRPC: Replace xprt->resend and xprt->sending with a priority queue

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>

Showing 2 changed files with 21 additions and 22 deletions Side-by-side Diff

include/linux/sunrpc/xprt.h
... ... @@ -165,7 +165,6 @@
165 165  
166 166 struct rpc_wait_queue binding; /* requests waiting on rpcbind */
167 167 struct rpc_wait_queue sending; /* requests waiting to send */
168   - struct rpc_wait_queue resend; /* requests waiting to resend */
169 168 struct rpc_wait_queue pending; /* requests in flight */
170 169 struct rpc_wait_queue backlog; /* waiting for slot */
171 170 struct list_head free; /* free slots */
... ... @@ -195,6 +195,7 @@
195 195 int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task)
196 196 {
197 197 struct rpc_rqst *req = task->tk_rqstp;
  198 + int priority;
198 199  
199 200 if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) {
200 201 if (task == xprt->snd_task)
201 202  
... ... @@ -214,10 +215,13 @@
214 215 task->tk_pid, xprt);
215 216 task->tk_timeout = 0;
216 217 task->tk_status = -EAGAIN;
217   - if (req != NULL && req->rq_ntrans)
218   - rpc_sleep_on(&xprt->resend, task, NULL);
  218 + if (req == NULL)
  219 + priority = RPC_PRIORITY_LOW;
  220 + else if (!req->rq_ntrans)
  221 + priority = RPC_PRIORITY_NORMAL;
219 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 225 return 0;
222 226 }
223 227 EXPORT_SYMBOL_GPL(xprt_reserve_xprt);
... ... @@ -244,6 +248,7 @@
244 248 int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task)
245 249 {
246 250 struct rpc_rqst *req = task->tk_rqstp;
  251 + int priority;
247 252  
248 253 if (test_and_set_bit(XPRT_LOCKED, &xprt->state)) {
249 254 if (task == xprt->snd_task)
250 255  
... ... @@ -265,10 +270,13 @@
265 270 dprintk("RPC: %5u failed to lock transport %p\n", task->tk_pid, xprt);
266 271 task->tk_timeout = 0;
267 272 task->tk_status = -EAGAIN;
268   - if (req != NULL && req->rq_ntrans)
269   - rpc_sleep_on(&xprt->resend, task, NULL);
  273 + if (req == NULL)
  274 + priority = RPC_PRIORITY_LOW;
  275 + else if (!req->rq_ntrans)
  276 + priority = RPC_PRIORITY_NORMAL;
270 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 280 return 0;
273 281 }
274 282 EXPORT_SYMBOL_GPL(xprt_reserve_xprt_cong);
... ... @@ -291,12 +299,9 @@
291 299 if (test_and_set_bit(XPRT_LOCKED, &xprt->state))
292 300 return;
293 301  
294   - task = rpc_wake_up_next(&xprt->resend);
295   - if (!task) {
296   - task = rpc_wake_up_next(&xprt->sending);
297   - if (task == NULL)
298   - goto out_unlock;
299   - }
  302 + task = rpc_wake_up_next(&xprt->sending);
  303 + if (task == NULL)
  304 + goto out_unlock;
300 305  
301 306 req = task->tk_rqstp;
302 307 xprt->snd_task = task;
... ... @@ -319,12 +324,9 @@
319 324 return;
320 325 if (RPCXPRT_CONGESTED(xprt))
321 326 goto out_unlock;
322   - task = rpc_wake_up_next(&xprt->resend);
323   - if (!task) {
324   - task = rpc_wake_up_next(&xprt->sending);
325   - if (task == NULL)
326   - goto out_unlock;
327   - }
  327 + task = rpc_wake_up_next(&xprt->sending);
  328 + if (task == NULL)
  329 + goto out_unlock;
328 330  
329 331 req = task->tk_rqstp;
330 332 if (req == NULL) {
... ... @@ -1177,8 +1179,7 @@
1177 1179  
1178 1180 rpc_init_wait_queue(&xprt->binding, "xprt_binding");
1179 1181 rpc_init_wait_queue(&xprt->pending, "xprt_pending");
1180   - rpc_init_wait_queue(&xprt->sending, "xprt_sending");
1181   - rpc_init_wait_queue(&xprt->resend, "xprt_resend");
  1182 + rpc_init_priority_wait_queue(&xprt->sending, "xprt_sending");
1182 1183 rpc_init_priority_wait_queue(&xprt->backlog, "xprt_backlog");
1183 1184  
1184 1185 xprt_init_xid(xprt);
... ... @@ -1240,7 +1241,6 @@
1240 1241 rpc_destroy_wait_queue(&xprt->binding);
1241 1242 rpc_destroy_wait_queue(&xprt->pending);
1242 1243 rpc_destroy_wait_queue(&xprt->sending);
1243   - rpc_destroy_wait_queue(&xprt->resend);
1244 1244 rpc_destroy_wait_queue(&xprt->backlog);
1245 1245 cancel_work_sync(&xprt->task_cleanup);
1246 1246 /*