aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc/sched.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/sunrpc/sched.h')
-rw-r--r--include/linux/sunrpc/sched.h41
1 files changed, 16 insertions, 25 deletions
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index f689f02e6793..d1a5c8c1a0f1 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -11,7 +11,6 @@
11 11
12#include <linux/timer.h> 12#include <linux/timer.h>
13#include <linux/sunrpc/types.h> 13#include <linux/sunrpc/types.h>
14#include <linux/rcupdate.h>
15#include <linux/spinlock.h> 14#include <linux/spinlock.h>
16#include <linux/wait.h> 15#include <linux/wait.h>
17#include <linux/workqueue.h> 16#include <linux/workqueue.h>
@@ -33,7 +32,8 @@ struct rpc_wait_queue;
33struct rpc_wait { 32struct rpc_wait {
34 struct list_head list; /* wait queue links */ 33 struct list_head list; /* wait queue links */
35 struct list_head links; /* Links to related tasks */ 34 struct list_head links; /* Links to related tasks */
36 struct rpc_wait_queue * rpc_waitq; /* RPC wait queue we're on */ 35 struct list_head timer_list; /* Timer list */
36 unsigned long expires;
37}; 37};
38 38
39/* 39/*
@@ -57,33 +57,25 @@ struct rpc_task {
57 __u8 tk_cred_retry; 57 __u8 tk_cred_retry;
58 58
59 /* 59 /*
60 * timeout_fn to be executed by timer bottom half
61 * callback to be executed after waking up 60 * callback to be executed after waking up
62 * action next procedure for async tasks 61 * action next procedure for async tasks
63 * tk_ops caller callbacks 62 * tk_ops caller callbacks
64 */ 63 */
65 void (*tk_timeout_fn)(struct rpc_task *);
66 void (*tk_callback)(struct rpc_task *); 64 void (*tk_callback)(struct rpc_task *);
67 void (*tk_action)(struct rpc_task *); 65 void (*tk_action)(struct rpc_task *);
68 const struct rpc_call_ops *tk_ops; 66 const struct rpc_call_ops *tk_ops;
69 void * tk_calldata; 67 void * tk_calldata;
70 68
71 /*
72 * tk_timer is used for async processing by the RPC scheduling
73 * primitives. You should not access this directly unless
74 * you have a pathological interest in kernel oopses.
75 */
76 struct timer_list tk_timer; /* kernel timer */
77 unsigned long tk_timeout; /* timeout for rpc_sleep() */ 69 unsigned long tk_timeout; /* timeout for rpc_sleep() */
78 unsigned short tk_flags; /* misc flags */ 70 unsigned short tk_flags; /* misc flags */
79 unsigned long tk_runstate; /* Task run status */ 71 unsigned long tk_runstate; /* Task run status */
80 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could 72 struct workqueue_struct *tk_workqueue; /* Normally rpciod, but could
81 * be any workqueue 73 * be any workqueue
82 */ 74 */
75 struct rpc_wait_queue *tk_waitqueue; /* RPC wait queue we're on */
83 union { 76 union {
84 struct work_struct tk_work; /* Async task work queue */ 77 struct work_struct tk_work; /* Async task work queue */
85 struct rpc_wait tk_wait; /* RPC wait */ 78 struct rpc_wait tk_wait; /* RPC wait */
86 struct rcu_head tk_rcu; /* for task deletion */
87 } u; 79 } u;
88 80
89 unsigned short tk_timeouts; /* maj timeouts */ 81 unsigned short tk_timeouts; /* maj timeouts */
@@ -123,6 +115,7 @@ struct rpc_task_setup {
123 const struct rpc_message *rpc_message; 115 const struct rpc_message *rpc_message;
124 const struct rpc_call_ops *callback_ops; 116 const struct rpc_call_ops *callback_ops;
125 void *callback_data; 117 void *callback_data;
118 struct workqueue_struct *workqueue;
126 unsigned short flags; 119 unsigned short flags;
127 signed char priority; 120 signed char priority;
128}; 121};
@@ -147,9 +140,7 @@ struct rpc_task_setup {
147 140
148#define RPC_TASK_RUNNING 0 141#define RPC_TASK_RUNNING 0
149#define RPC_TASK_QUEUED 1 142#define RPC_TASK_QUEUED 1
150#define RPC_TASK_WAKEUP 2 143#define RPC_TASK_ACTIVE 2
151#define RPC_TASK_HAS_TIMER 3
152#define RPC_TASK_ACTIVE 4
153 144
154#define RPC_IS_RUNNING(t) test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 145#define RPC_IS_RUNNING(t) test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
155#define rpc_set_running(t) set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate) 146#define rpc_set_running(t) set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate)
@@ -171,15 +162,6 @@ struct rpc_task_setup {
171 smp_mb__after_clear_bit(); \ 162 smp_mb__after_clear_bit(); \
172 } while (0) 163 } while (0)
173 164
174#define rpc_start_wakeup(t) \
175 (test_and_set_bit(RPC_TASK_WAKEUP, &(t)->tk_runstate) == 0)
176#define rpc_finish_wakeup(t) \
177 do { \
178 smp_mb__before_clear_bit(); \
179 clear_bit(RPC_TASK_WAKEUP, &(t)->tk_runstate); \
180 smp_mb__after_clear_bit(); \
181 } while (0)
182
183#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate) 165#define RPC_IS_ACTIVATED(t) test_bit(RPC_TASK_ACTIVE, &(t)->tk_runstate)
184 166
185/* 167/*
@@ -192,6 +174,12 @@ struct rpc_task_setup {
192#define RPC_PRIORITY_HIGH (1) 174#define RPC_PRIORITY_HIGH (1)
193#define RPC_NR_PRIORITY (1 + RPC_PRIORITY_HIGH - RPC_PRIORITY_LOW) 175#define RPC_NR_PRIORITY (1 + RPC_PRIORITY_HIGH - RPC_PRIORITY_LOW)
194 176
177struct rpc_timer {
178 struct timer_list timer;
179 struct list_head list;
180 unsigned long expires;
181};
182
195/* 183/*
196 * RPC synchronization objects 184 * RPC synchronization objects
197 */ 185 */
@@ -204,6 +192,7 @@ struct rpc_wait_queue {
204 unsigned char count; /* # task groups remaining serviced so far */ 192 unsigned char count; /* # task groups remaining serviced so far */
205 unsigned char nr; /* # tasks remaining for cookie */ 193 unsigned char nr; /* # tasks remaining for cookie */
206 unsigned short qlen; /* total # tasks waiting in queue */ 194 unsigned short qlen; /* total # tasks waiting in queue */
195 struct rpc_timer timer_list;
207#ifdef RPC_DEBUG 196#ifdef RPC_DEBUG
208 const char * name; 197 const char * name;
209#endif 198#endif
@@ -229,9 +218,11 @@ void rpc_killall_tasks(struct rpc_clnt *);
229void rpc_execute(struct rpc_task *); 218void rpc_execute(struct rpc_task *);
230void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); 219void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
231void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); 220void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
221void rpc_destroy_wait_queue(struct rpc_wait_queue *);
232void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *, 222void rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
233 rpc_action action, rpc_action timer); 223 rpc_action action);
234void rpc_wake_up_task(struct rpc_task *); 224void rpc_wake_up_queued_task(struct rpc_wait_queue *,
225 struct rpc_task *);
235void rpc_wake_up(struct rpc_wait_queue *); 226void rpc_wake_up(struct rpc_wait_queue *);
236struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *); 227struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
237void rpc_wake_up_status(struct rpc_wait_queue *, int); 228void rpc_wake_up_status(struct rpc_wait_queue *, int);