patch-2.2.18 linux/include/linux/sunrpc/sched.h

Next file: linux/include/linux/sunrpc/svcsock.h
Previous file: linux/include/linux/sunrpc/clnt.h
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/include/linux/sunrpc/sched.h linux/include/linux/sunrpc/sched.h
@@ -11,6 +11,8 @@
 
 #include <linux/timer.h>
 #include <linux/tqueue.h>
+#include <asm/errno.h>
+#include <asm/spinlock.h>
 #include <linux/sunrpc/types.h>
 
 /*
@@ -20,6 +22,16 @@
 #undef  CONFIG_RPC_FASTSCHED
 
 /*
+ * This is the actual RPC procedure call info.
+ */
+struct rpc_message {
+	__u32			rpc_proc;	/* Procedure number */
+	void *			rpc_argp;	/* Arguments */
+	void *			rpc_resp;	/* Result */
+	struct rpc_cred *	rpc_cred;	/* Credentials */
+};
+
+/*
  * This is the RPC task struct
  */
 struct rpc_task {
@@ -30,19 +42,17 @@
 #endif
 	struct rpc_task *	tk_next_task;	/* global list of tasks */
 	struct rpc_task *	tk_prev_task;	/* global list of tasks */
+	struct rpc_task *	tk_parent;	/* parent task */
 	struct rpc_clnt *	tk_client;	/* RPC client */
 	struct rpc_rqst *	tk_rqstp;	/* RPC request */
-	struct rpc_cred *	tk_cred;	/* RPC credentials */
-	int			tk_status;	/* result of last operation */
+	volatile int		tk_status;	/* result of last operation */
 	struct rpc_wait_queue *	tk_rpcwait;	/* RPC wait queue we're on */
 
 	/*
 	 * RPC call state
 	 */
-	__u32			tk_proc;	/* procedure number */
+	struct rpc_message	tk_msg;		/* RPC call info */
 	__u32 *			tk_buffer;	/* XDR buffer */
-	void *			tk_argp;	/* argument storage */
-	void *			tk_resp;	/* result storage */
 	__u8			tk_garb_retry,
 				tk_cred_retry,
 				tk_suid_retry;
@@ -52,9 +62,11 @@
 	 * action	next procedure for async tasks
 	 * exit		exit async task and report to caller
 	 */
+	void			(*tk_timeout_fn)(struct rpc_task *);
 	void			(*tk_callback)(struct rpc_task *);
 	void			(*tk_action)(struct rpc_task *);
 	void			(*tk_exit)(struct rpc_task *);
+	void			(*tk_release)(struct rpc_task *);
 	void *			tk_calldata;
 
 	/*
@@ -65,9 +77,14 @@
 	struct timer_list	tk_timer;	/* kernel timer */
 	struct wait_queue *	tk_wait;	/* sync: sleep on this q */
 	unsigned long		tk_timeout;	/* timeout for rpc_sleep() */
-	unsigned short		tk_flags;	/* misc flags */
+	unsigned int		tk_flags;	/* misc flags */
+	unsigned int		tk_lock;	/* Task lock counter */
+	unsigned char		tk_active   : 1,/* Task has been activated */
+				tk_wakeup   : 1;/* Task waiting to wake up */
+	volatile unsigned char	tk_running  : 1,/* Task is running */
+				tk_sleeping : 1;/* Task is truly asleep */
 #ifdef RPC_DEBUG
-	unsigned short		tk_pid;		/* debugging aid */
+	unsigned int		tk_pid;		/* debugging aid */
 #endif
 };
 #define tk_auth			tk_client->cl_auth
@@ -78,27 +95,27 @@
 /*
  * RPC task flags
  */
-#define RPC_TASK_RUNNING	0x0001		/* is running */
-#define RPC_TASK_ASYNC		0x0002		/* is an async task */
-#define RPC_TASK_CALLBACK	0x0004		/* invoke callback */
-#define RPC_TASK_SWAPPER	0x0008		/* is swapping in/out */
-#define RPC_TASK_SETUID		0x0010		/* is setuid process */
-#define RPC_TASK_CHILD		0x0020		/* is child of other task */
-#define RPC_CALL_REALUID	0x0040		/* try using real uid */
-#define RPC_CALL_MAJORSEEN	0x0080		/* major timeout seen */
-#define RPC_TASK_ROOTCREDS	0x0100		/* force root creds */
-#define RPC_TASK_DYNAMIC	0x0200		/* task was kmalloc'ed */
-#define RPC_TASK_KILLED		0x0400		/* task was killed */
-#define RPC_TASK_NFSWRITE	0x1000		/* an NFS writeback */
+#define RPC_TASK_ASYNC		0x0001		/* is an async task */
+#define RPC_TASK_SWAPPER	0x0002		/* is swapping in/out */
+#define RPC_TASK_SETUID		0x0004		/* is setuid process */
+#define RPC_TASK_CHILD		0x0008		/* is child of other task */
+#define RPC_CALL_REALUID	0x0010		/* try using real uid */
+#define RPC_CALL_MAJORSEEN	0x0020		/* major timeout seen */
+#define RPC_TASK_ROOTCREDS	0x0040		/* force root creds */
+#define RPC_TASK_DYNAMIC	0x0080		/* task was kmalloc'ed */
+#define RPC_TASK_KILLED		0x0100		/* task was killed */
+#define RPC_TASK_PRIORITY	0x0200		/* resched when waking up */
 
-#define RPC_IS_RUNNING(t)	((t)->tk_flags & RPC_TASK_RUNNING)
 #define RPC_IS_ASYNC(t)		((t)->tk_flags & RPC_TASK_ASYNC)
 #define RPC_IS_SETUID(t)	((t)->tk_flags & RPC_TASK_SETUID)
 #define RPC_IS_CHILD(t)		((t)->tk_flags & RPC_TASK_CHILD)
 #define RPC_IS_SWAPPER(t)	((t)->tk_flags & RPC_TASK_SWAPPER)
-#define RPC_DO_CALLBACK(t)	((t)->tk_flags & RPC_TASK_CALLBACK)
 #define RPC_DO_ROOTOVERRIDE(t)	((t)->tk_flags & RPC_TASK_ROOTCREDS)
 #define RPC_ASSASSINATED(t)	((t)->tk_flags & RPC_TASK_KILLED)
+#define RPC_IS_RUNNING(t)	((t)->tk_running)
+#define RPC_IS_SLEEPING(t)	((t)->tk_sleeping)
+#define RPC_IS_ACTIVATED(t)	((t)->tk_active)
+#define RPC_DO_CALLBACK(t)	((t)->tk_callback != NULL)
 
 /*
  * RPC synchronization objects
@@ -110,6 +127,7 @@
 #endif
 };
 
+#define RPC_WAITQ_EMPTY(q)	((q)->task == NULL)
 #ifndef RPC_DEBUG
 # define RPC_INIT_WAITQ(name)	((struct rpc_wait_queue) { NULL })
 #else
@@ -125,51 +143,60 @@
 					rpc_action exitfunc, int flags);
 void		rpc_release_task(struct rpc_task *);
 void		rpc_killall_tasks(struct rpc_clnt *);
-void		rpc_execute(struct rpc_task *);
+int		rpc_execute(struct rpc_task *);
 void		rpc_run_child(struct rpc_task *parent, struct rpc_task *child,
 					rpc_action action);
-int		rpc_add_wait_queue(struct rpc_wait_queue *, struct rpc_task *);
+int		rpc_add_wait_queue(struct rpc_wait_queue *,
+				     struct rpc_task *);
 void		rpc_remove_wait_queue(struct rpc_task *);
 void		rpc_sleep_on(struct rpc_wait_queue *, struct rpc_task *,
 					rpc_action action, rpc_action timer);
-void		rpc_cond_wait(struct rpc_wait_queue *, struct rpc_task *,
-					unsigned char *,
-					rpc_action action, rpc_action timer);
+void		rpc_sleep_locked(struct rpc_wait_queue *, struct rpc_task *,
+				 rpc_action action, rpc_action timer);
+void		rpc_add_timer(struct rpc_task *task, rpc_action timer);
 void		rpc_wake_up_task(struct rpc_task *);
 void		rpc_wake_up(struct rpc_wait_queue *);
 struct rpc_task *rpc_wake_up_next(struct rpc_wait_queue *);
 void		rpc_wake_up_status(struct rpc_wait_queue *, int);
-void		rpc_add_timer(struct rpc_task *, rpc_action);
-void		rpc_del_timer(struct rpc_task *);
+int		__rpc_lock_task(struct rpc_task *);
+void		rpc_unlock_task(struct rpc_task *);
 void		rpc_delay(struct rpc_task *, unsigned long);
 void *		rpc_allocate(unsigned int flags, unsigned int);
 void		rpc_free(void *);
 int		rpciod_up(void);
 void		rpciod_down(void);
 void		rpciod_wake_up(void);
-void		rpciod_tcp_dispatcher(void);
 #ifdef RPC_DEBUG
 void		rpc_show_tasks(void);
 #endif
 
-extern __inline__ void *
+static __inline__ void *
 rpc_malloc(struct rpc_task *task, unsigned int size)
 {
 	return rpc_allocate(task->tk_flags, size);
 }
 
-extern __inline__ void
+static __inline__ void
 rpc_exit(struct rpc_task *task, int status)
 {
 	task->tk_status = status;
 	task->tk_action = NULL;
 }
 
+static __inline__ void
+rpc_kill(struct rpc_task *task, int status)
+{
+        rpc_exit(task, status);
+        rpc_wake_up_task(task);
+}
+
+extern spinlock_t rpc_queue_lock;
+
 #ifdef RPC_DEBUG
-extern __inline__ char *
+static __inline__ char *
 rpc_qname(struct rpc_wait_queue *q)
 {
-	return q->name? q->name : "unknown";
+	return q? (q->name? q->name : "unknown") : "none";
 }
 #endif
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)