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>
This commit is contained in:
@@ -172,7 +172,7 @@ extern struct nlm_host *nlm_find_client(void);
|
||||
/*
|
||||
* Server-side lock handling
|
||||
*/
|
||||
int nlmsvc_async_call(struct nlm_rqst *, u32, rpc_action);
|
||||
int nlmsvc_async_call(struct nlm_rqst *, u32, const struct rpc_call_ops *);
|
||||
u32 nlmsvc_lock(struct svc_rqst *, struct nlm_file *,
|
||||
struct nlm_lock *, int, struct nlm_cookie *);
|
||||
u32 nlmsvc_unlock(struct nlm_file *, struct nlm_lock *);
|
||||
|
@@ -406,10 +406,12 @@ extern int nfs_writepage(struct page *page, struct writeback_control *wbc);
|
||||
extern int nfs_writepages(struct address_space *, struct writeback_control *);
|
||||
extern int nfs_flush_incompatible(struct file *file, struct page *page);
|
||||
extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
|
||||
extern void nfs_writeback_done(struct rpc_task *task);
|
||||
extern void nfs_writeback_done(struct rpc_task *task, void *data);
|
||||
extern void nfs_writedata_release(void *data);
|
||||
|
||||
#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4)
|
||||
extern void nfs_commit_done(struct rpc_task *);
|
||||
extern void nfs_commit_done(struct rpc_task *, void *data);
|
||||
extern void nfs_commit_release(void *data);
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -481,7 +483,9 @@ static inline void nfs_writedata_free(struct nfs_write_data *p)
|
||||
extern int nfs_readpage(struct file *, struct page *);
|
||||
extern int nfs_readpages(struct file *, struct address_space *,
|
||||
struct list_head *, unsigned);
|
||||
extern void nfs_readpage_result(struct rpc_task *);
|
||||
extern void nfs_readpage_result(struct rpc_task *, void *);
|
||||
extern void nfs_readdata_release(void *data);
|
||||
|
||||
|
||||
/*
|
||||
* Allocate and free nfs_read_data structures
|
||||
@@ -501,8 +505,6 @@ static inline void nfs_readdata_free(struct nfs_read_data *p)
|
||||
mempool_free(p, nfs_rdata_mempool);
|
||||
}
|
||||
|
||||
extern void nfs_readdata_release(struct rpc_task *task);
|
||||
|
||||
/*
|
||||
* linux/fs/nfs3proc.c
|
||||
*/
|
||||
|
@@ -126,7 +126,8 @@ int rpc_register(u32, u32, int, unsigned short, int *);
|
||||
void rpc_call_setup(struct rpc_task *, struct rpc_message *, int);
|
||||
|
||||
int rpc_call_async(struct rpc_clnt *clnt, struct rpc_message *msg,
|
||||
int flags, rpc_action callback, void *clntdata);
|
||||
int flags, const struct rpc_call_ops *tk_ops,
|
||||
void *calldata);
|
||||
int rpc_call_sync(struct rpc_clnt *clnt, struct rpc_message *msg,
|
||||
int flags);
|
||||
void rpc_restart_call(struct rpc_task *);
|
||||
|
@@ -27,6 +27,7 @@ struct rpc_message {
|
||||
struct rpc_cred * rpc_cred; /* Credentials */
|
||||
};
|
||||
|
||||
struct rpc_call_ops;
|
||||
struct rpc_wait_queue;
|
||||
struct rpc_wait {
|
||||
struct list_head list; /* wait queue links */
|
||||
@@ -61,13 +62,12 @@ struct rpc_task {
|
||||
* timeout_fn to be executed by timer bottom half
|
||||
* callback to be executed after waking up
|
||||
* action next procedure for async tasks
|
||||
* exit exit async task and report to caller
|
||||
* tk_ops caller callbacks
|
||||
*/
|
||||
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 *);
|
||||
const struct rpc_call_ops *tk_ops;
|
||||
void * tk_calldata;
|
||||
|
||||
/*
|
||||
@@ -111,6 +111,12 @@ struct rpc_task {
|
||||
|
||||
typedef void (*rpc_action)(struct rpc_task *);
|
||||
|
||||
struct rpc_call_ops {
|
||||
void (*rpc_call_done)(struct rpc_task *, void *);
|
||||
void (*rpc_release)(void *);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* RPC task flags
|
||||
*/
|
||||
@@ -228,10 +234,12 @@ struct rpc_wait_queue {
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
struct rpc_task *rpc_new_task(struct rpc_clnt *, rpc_action, int flags);
|
||||
struct rpc_task *rpc_new_task(struct rpc_clnt *, int flags,
|
||||
const struct rpc_call_ops *ops, void *data);
|
||||
struct rpc_task *rpc_new_child(struct rpc_clnt *, struct rpc_task *parent);
|
||||
void rpc_init_task(struct rpc_task *, struct rpc_clnt *,
|
||||
rpc_action exitfunc, int flags);
|
||||
void rpc_init_task(struct rpc_task *task, struct rpc_clnt *clnt,
|
||||
int flags, const struct rpc_call_ops *ops,
|
||||
void *data);
|
||||
void rpc_release_task(struct rpc_task *);
|
||||
void rpc_exit_task(struct rpc_task *);
|
||||
void rpc_killall_tasks(struct rpc_clnt *);
|
||||
|
Reference in New Issue
Block a user