sched.c (150030b78a454ba50d5e267b0dcf01b162809192) sched.c (b24b8a247ff65c01b252025926fe564209fae4fc)
1/*
2 * linux/net/sunrpc/sched.c
3 *
4 * Scheduling for synchronous and asynchronous RPC requests.
5 *
6 * Copyright (C) 1996 Olaf Kirch, <okir@monad.swb.de>
7 *
8 * TCP NFS related read + write fixes

--- 231 unchanged lines hidden (view full) ---

240}
241
242void rpc_init_wait_queue(struct rpc_wait_queue *queue, const char *qname)
243{
244 __rpc_init_priority_wait_queue(queue, qname, 0);
245}
246EXPORT_SYMBOL(rpc_init_wait_queue);
247
1/*
2 * linux/net/sunrpc/sched.c
3 *
4 * Scheduling for synchronous and asynchronous RPC requests.
5 *
6 * Copyright (C) 1996 Olaf Kirch, <okir@monad.swb.de>
7 *
8 * TCP NFS related read + write fixes

--- 231 unchanged lines hidden (view full) ---

240}
241
242void rpc_init_wait_queue(struct rpc_wait_queue *queue, const char *qname)
243{
244 __rpc_init_priority_wait_queue(queue, qname, 0);
245}
246EXPORT_SYMBOL(rpc_init_wait_queue);
247
248static int rpc_wait_bit_killable(void *word)
248static int rpc_wait_bit_interruptible(void *word)
249{
249{
250 if (fatal_signal_pending(current))
250 if (signal_pending(current))
251 return -ERESTARTSYS;
252 schedule();
253 return 0;
254}
255
256#ifdef RPC_DEBUG
257static void rpc_task_set_debuginfo(struct rpc_task *task)
258{

--- 35 unchanged lines hidden (view full) ---

294}
295
296/*
297 * Allow callers to wait for completion of an RPC call
298 */
299int __rpc_wait_for_completion_task(struct rpc_task *task, int (*action)(void *))
300{
301 if (action == NULL)
251 return -ERESTARTSYS;
252 schedule();
253 return 0;
254}
255
256#ifdef RPC_DEBUG
257static void rpc_task_set_debuginfo(struct rpc_task *task)
258{

--- 35 unchanged lines hidden (view full) ---

294}
295
296/*
297 * Allow callers to wait for completion of an RPC call
298 */
299int __rpc_wait_for_completion_task(struct rpc_task *task, int (*action)(void *))
300{
301 if (action == NULL)
302 action = rpc_wait_bit_killable;
302 action = rpc_wait_bit_interruptible;
303 return wait_on_bit(&task->tk_runstate, RPC_TASK_ACTIVE,
303 return wait_on_bit(&task->tk_runstate, RPC_TASK_ACTIVE,
304 action, TASK_KILLABLE);
304 action, TASK_INTERRUPTIBLE);
305}
306EXPORT_SYMBOL(__rpc_wait_for_completion_task);
307
308/*
309 * Make an RPC task runnable.
310 *
311 * Note: If the task is ASYNC, this must be called with
312 * the spinlock held to protect the wait queue operation.

--- 372 unchanged lines hidden (view full) ---

685 return;
686 if (rpc_test_and_set_running(task))
687 return;
688 continue;
689 }
690
691 /* sync task: sleep here */
692 dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid);
305}
306EXPORT_SYMBOL(__rpc_wait_for_completion_task);
307
308/*
309 * Make an RPC task runnable.
310 *
311 * Note: If the task is ASYNC, this must be called with
312 * the spinlock held to protect the wait queue operation.

--- 372 unchanged lines hidden (view full) ---

685 return;
686 if (rpc_test_and_set_running(task))
687 return;
688 continue;
689 }
690
691 /* sync task: sleep here */
692 dprintk("RPC: %5u sync task going to sleep\n", task->tk_pid);
693 /* Note: Caller should be using rpc_clnt_sigmask() */
693 status = out_of_line_wait_on_bit(&task->tk_runstate,
694 status = out_of_line_wait_on_bit(&task->tk_runstate,
694 RPC_TASK_QUEUED, rpc_wait_bit_killable,
695 TASK_KILLABLE);
695 RPC_TASK_QUEUED, rpc_wait_bit_interruptible,
696 TASK_INTERRUPTIBLE);
696 if (status == -ERESTARTSYS) {
697 /*
698 * When a sync task receives a signal, it exits with
699 * -ERESTARTSYS. In order to catch any callbacks that
700 * clean up after sleeping on some queue, we don't
701 * break the loop here, but go around once more.
702 */
703 dprintk("RPC: %5u got signal\n", task->tk_pid);

--- 101 unchanged lines hidden (view full) ---

805EXPORT_SYMBOL_GPL(rpc_free);
806
807/*
808 * Creation and deletion of RPC task structures
809 */
810void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, const struct rpc_call_ops *tk_ops, void *calldata)
811{
812 memset(task, 0, sizeof(*task));
697 if (status == -ERESTARTSYS) {
698 /*
699 * When a sync task receives a signal, it exits with
700 * -ERESTARTSYS. In order to catch any callbacks that
701 * clean up after sleeping on some queue, we don't
702 * break the loop here, but go around once more.
703 */
704 dprintk("RPC: %5u got signal\n", task->tk_pid);

--- 101 unchanged lines hidden (view full) ---

806EXPORT_SYMBOL_GPL(rpc_free);
807
808/*
809 * Creation and deletion of RPC task structures
810 */
811void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt, int flags, const struct rpc_call_ops *tk_ops, void *calldata)
812{
813 memset(task, 0, sizeof(*task));
813 init_timer(&task->tk_timer);
814 task->tk_timer.data = (unsigned long) task;
815 task->tk_timer.function = (void (*)(unsigned long)) rpc_run_timer;
814 setup_timer(&task->tk_timer, (void (*)(unsigned long))rpc_run_timer,
815 (unsigned long)task);
816 atomic_set(&task->tk_count, 1);
817 task->tk_client = clnt;
818 task->tk_flags = flags;
819 task->tk_ops = tk_ops;
820 if (tk_ops->rpc_call_prepare != NULL)
821 task->tk_action = rpc_prepare_task;
822 task->tk_calldata = calldata;
823 INIT_LIST_HEAD(&task->tk_task);

--- 7 unchanged lines hidden (view full) ---

831
832 /* Initialize workqueue for async tasks */
833 task->tk_workqueue = rpciod_workqueue;
834
835 if (clnt) {
836 kref_get(&clnt->cl_kref);
837 if (clnt->cl_softrtry)
838 task->tk_flags |= RPC_TASK_SOFT;
816 atomic_set(&task->tk_count, 1);
817 task->tk_client = clnt;
818 task->tk_flags = flags;
819 task->tk_ops = tk_ops;
820 if (tk_ops->rpc_call_prepare != NULL)
821 task->tk_action = rpc_prepare_task;
822 task->tk_calldata = calldata;
823 INIT_LIST_HEAD(&task->tk_task);

--- 7 unchanged lines hidden (view full) ---

831
832 /* Initialize workqueue for async tasks */
833 task->tk_workqueue = rpciod_workqueue;
834
835 if (clnt) {
836 kref_get(&clnt->cl_kref);
837 if (clnt->cl_softrtry)
838 task->tk_flags |= RPC_TASK_SOFT;
839 if (!clnt->cl_intr)
840 task->tk_flags |= RPC_TASK_NOINTR;
839 }
840
841 BUG_ON(task->tk_ops == NULL);
842
843 /* starting timestamp */
844 task->tk_start = jiffies;
845
846 dprintk("RPC: new task initialized, procpid %u\n",

--- 197 unchanged lines hidden ---
841 }
842
843 BUG_ON(task->tk_ops == NULL);
844
845 /* starting timestamp */
846 task->tk_start = jiffies;
847
848 dprintk("RPC: new task initialized, procpid %u\n",

--- 197 unchanged lines hidden ---