diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-03 03:55:04 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-01-06 14:58:39 -0500 |
commit | 963d8fe53339128ee46a7701f2e36305f0ccff8c (patch) | |
tree | 426736c70a8e05cb1d945d5c7f44ea6475edd113 /include | |
parent | abbcf28f23d53e8ec56a91f3528743913fa2694a (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.h | 2 | ||||
-rw-r--r-- | include/linux/nfs_fs.h | 12 | ||||
-rw-r--r-- | include/linux/sunrpc/clnt.h | 3 | ||||
-rw-r--r-- | include/linux/sunrpc/sched.h | 20 |
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 | */ |
175 | int nlmsvc_async_call(struct nlm_rqst *, u32, rpc_action); | 175 | int nlmsvc_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *); |
176 | u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, | 176 | u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *, |
177 | struct nlm_lock *, int, struct nlm_cookie *); | 177 | struct nlm_lock *, int, struct nlm_cookie *); |
178 | u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *); | 178 | u32 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); | |||
406 | extern int nfs_writepages(struct address_space *, struct writeback_control *); | 406 | extern int nfs_writepages(struct address_space *, struct writeback_control *); |
407 | extern int nfs_flush_incompatible(struct file *file, struct page *page); | 407 | extern int nfs_flush_incompatible(struct file *file, struct page *page); |
408 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); | 408 | extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); |
409 | extern void nfs_writeback_done(struct rpc_task *task); | 409 | extern void nfs_writeback_done(struct rpc_task *task, void *data); |
410 | extern 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) |
412 | extern void nfs_commit_done(struct rpc_task *); | 413 | extern void nfs_commit_done(struct rpc_task *, void *data); |
414 | extern 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) | |||
481 | extern int nfs_readpage(struct file *, struct page *); | 483 | extern int nfs_readpage(struct file *, struct page *); |
482 | extern int nfs_readpages(struct file *, struct address_space *, | 484 | extern int nfs_readpages(struct file *, struct address_space *, |
483 | struct list_head *, unsigned); | 485 | struct list_head *, unsigned); |
484 | extern void nfs_readpage_result(struct rpc_task *); | 486 | extern void nfs_readpage_result(struct rpc_task *, void *); |
487 | extern 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 | ||
504 | extern 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 *); | |||
126 | void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); | 126 | void rpc_call_setup(struct rpc_task *, struct rpc_message *, int); |
127 | 127 | ||
128 | int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg, | 128 | int 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); | ||
130 | int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, | 131 | int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg, |
131 | int flags); | 132 | int flags); |
132 | void rpc_restart_call(struct rpc_task *); | 133 | void 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 | ||
30 | struct rpc_call_ops; | ||
30 | struct rpc_wait_queue; | 31 | struct rpc_wait_queue; |
31 | struct rpc_wait { | 32 | struct 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 | ||
112 | typedef void (*rpc_action)(struct rpc_task *); | 112 | typedef void (*rpc_action)(struct rpc_task *); |
113 | 113 | ||
114 | struct 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 | */ |
231 | struct rpc_task *rpc_new_task(struct rpc_clnt *, rpc_action, int flags); | 237 | struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags, |
238 | const struct rpc_call_ops *ops, void *data); | ||
232 | struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); | 239 | struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent); |
233 | void rpc_init_task(struct rpc_task *, struct rpc_clnt *, | 240 | void 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); | ||
235 | void rpc_release_task(struct rpc_task *); | 243 | void rpc_release_task(struct rpc_task *); |
236 | void rpc_exit_task(struct rpc_task *); | 244 | void rpc_exit_task(struct rpc_task *); |
237 | void rpc_killall_tasks(struct rpc_clnt *); | 245 | void rpc_killall_tasks(struct rpc_clnt *); |