aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-03 03:55:04 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-01-06 14:58:39 -0500
commit963d8fe53339128ee46a7701f2e36305f0ccff8c (patch)
tree426736c70a8e05cb1d945d5c7f44ea6475edd113 /include
parentabbcf28f23d53e8ec56a91f3528743913fa2694a (diff)
RPC: Clean up RPC task structure
Shrink the RPC task structure. Instead of storing separate pointers for task->tk_exit and task->tk_release, put them in a structure. Also pass the user data pointer as a parameter instead of passing it via task->tk_calldata. This enables us to nest callbacks. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/lockd/lockd.h2
-rw-r--r--include/linux/nfs_fs.h12
-rw-r--r--include/linux/sunrpc/clnt.h3
-rw-r--r--include/linux/sunrpc/sched.h20
4 files changed, 24 insertions, 13 deletions
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 16d4e5a08e1d..95c8fea293ba 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -172,7 +172,7 @@ extern struct nlm_host *nlm_find_client(void);
172/* 172/*
173 * Server-side lock handling 173 * Server-side lock handling
174 */ 174 */
175int nlmsvc_async_call(struct nlm_rqst *, u32, rpc_action); 175int nlmsvc_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, 176u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
177 struct nlm_lock *, int, struct nlm_cookie *); 177 struct nlm_lock *, int, struct nlm_cookie *);
178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); 178u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 2516adeccecf..4dff705d2ff2 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -406,10 +406,12 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
406extern int nfs_writepages(struct address_space *, struct writeback_control *); 406extern int nfs_writepages(struct address_space *, struct writeback_control *);
407extern int nfs_flush_incompatible(struct file *file, struct page *page); 407extern int nfs_flush_incompatible(struct file *file, struct page *page);
408extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 408extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
409extern void nfs_writeback_done(struct rpc_task *task); 409extern void nfs_writeback_done(struct rpc_task *task, void *data);
410extern void nfs_writedata_release(void *data);
410 411
411#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 412#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
412extern void nfs_commit_done(struct rpc_task *); 413extern void nfs_commit_done(struct rpc_task *, void *data);
414extern void nfs_commit_release(void *data);
413#endif 415#endif
414 416
415/* 417/*
@@ -481,7 +483,9 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
481extern int nfs_readpage(struct file *, struct page *); 483extern int nfs_readpage(struct file *, struct page *);
482extern int nfs_readpages(struct file *, struct address_space *, 484extern int nfs_readpages(struct file *, struct address_space *,
483 struct list_head *, unsigned); 485 struct list_head *, unsigned);
484extern void nfs_readpage_result(struct rpc_task *); 486extern void nfs_readpage_result(struct rpc_task *, void *);
487extern void nfs_readdata_release(void *data);
488
485 489
486/* 490/*
487 * Allocate and free nfs_read_data structures 491 * Allocate and free nfs_read_data structures
@@ -501,8 +505,6 @@ static inline void nfs_readdata_free(struct nfs_read_data *p)
501 mempool_free(p, nfs_rdata_mempool); 505 mempool_free(p, nfs_rdata_mempool);
502} 506}
503 507
504extern void nfs_readdata_release(struct rpc_task *task);
505
506/* 508/*
507 * linux/fs/nfs3proc.c 509 * linux/fs/nfs3proc.c
508 */ 510 */
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index ab151bbb66df..b0ab959eca65 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -126,7 +126,8 @@ int rpc_register(u32, u32, int, unsigned short, int *);
126void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); 126void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
127 127
128int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, 128int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
129 int flags, rpc_action callback, void *clntdata); 129 int flags, const struct rpc_call_ops *tk_ops,
130 void *calldata);
130int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, 131int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
131 int flags); 132 int flags);
132void rpc_restart_call(struct rpc_task *); 133void rpc_restart_call(struct rpc_task *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 4c4b2dc8aca5..581d8cdc3b86 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -27,6 +27,7 @@ struct rpc_message {
27 struct rpc_cred * rpc_cred; /* Credentials */ 27 struct rpc_cred * rpc_cred; /* Credentials */
28}; 28};
29 29
30struct rpc_call_ops;
30struct rpc_wait_queue; 31struct rpc_wait_queue;
31struct rpc_wait { 32struct rpc_wait {
32 struct list_head list; /* wait queue links */ 33 struct list_head list; /* wait queue links */
@@ -61,13 +62,12 @@ struct rpc_task {
61 * timeout_fn to be executed by timer bottom half 62 * timeout_fn to be executed by timer bottom half
62 * callback to be executed after waking up 63 * callback to be executed after waking up
63 * action next procedure for async tasks 64 * action next procedure for async tasks
64 * exit exit async task and report to caller 65 * tk_ops caller callbacks
65 */ 66 */
66 void (*tk_timeout_fn)(struct rpc_task *); 67 void (*tk_timeout_fn)(struct rpc_task *);
67 void (*tk_callback)(struct rpc_task *); 68 void (*tk_callback)(struct rpc_task *);
68 void (*tk_action)(struct rpc_task *); 69 void (*tk_action)(struct rpc_task *);
69 void (*tk_exit)(struct rpc_task *); 70 const struct rpc_call_ops *tk_ops;
70 void (*tk_release)(struct rpc_task *);
71 void * tk_calldata; 71 void * tk_calldata;
72 72
73 /* 73 /*
@@ -111,6 +111,12 @@ struct rpc_task {
111 111
112typedef void (*rpc_action)(struct rpc_task *); 112typedef void (*rpc_action)(struct rpc_task *);
113 113
114struct rpc_call_ops {
115 void (*rpc_call_done)(struct rpc_task *, void *);
116 void (*rpc_release)(void *);
117};
118
119
114/* 120/*
115 * RPC task flags 121 * RPC task flags
116 */ 122 */
@@ -228,10 +234,12 @@ struct rpc_wait_queue {
228/* 234/*
229 * Function prototypes 235 * Function prototypes
230 */ 236 */
231struct rpc_task *rpc_new_task(struct rpc_clnt *, rpc_action, int flags); 237struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags,
238 const struct rpc_call_ops *ops, void *data);
232struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); 239struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent);
233void rpc_init_task(struct rpc_task *, struct rpc_clnt *, 240void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
234 rpc_action exitfunc, int flags); 241 int flags, const struct rpc_call_ops *ops,
242 void *data);
235void rpc_release_task(struct rpc_task *); 243void rpc_release_task(struct rpc_task *);
236void rpc_exit_task(struct rpc_task *); 244void rpc_exit_task(struct rpc_task *);
237void rpc_killall_tasks(struct rpc_clnt *); 245void rpc_killall_tasks(struct rpc_clnt *);