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 /fs/nfs/write.c | |
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 'fs/nfs/write.c')
-rw-r--r-- | fs/nfs/write.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 95d00f9132d0..80bc4ea1b824 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -104,9 +104,8 @@ static inline void nfs_commit_free(struct nfs_write_data *p) | |||
104 | mempool_free(p, nfs_commit_mempool); | 104 | mempool_free(p, nfs_commit_mempool); |
105 | } | 105 | } |
106 | 106 | ||
107 | static void nfs_writedata_release(struct rpc_task *task) | 107 | void nfs_writedata_release(void *wdata) |
108 | { | 108 | { |
109 | struct nfs_write_data *wdata = (struct nfs_write_data *)task->tk_calldata; | ||
110 | nfs_writedata_free(wdata); | 109 | nfs_writedata_free(wdata); |
111 | } | 110 | } |
112 | 111 | ||
@@ -871,9 +870,6 @@ static void nfs_write_rpcsetup(struct nfs_page *req, | |||
871 | 870 | ||
872 | data->task.tk_priority = flush_task_priority(how); | 871 | data->task.tk_priority = flush_task_priority(how); |
873 | data->task.tk_cookie = (unsigned long)inode; | 872 | data->task.tk_cookie = (unsigned long)inode; |
874 | data->task.tk_calldata = data; | ||
875 | /* Release requests */ | ||
876 | data->task.tk_release = nfs_writedata_release; | ||
877 | 873 | ||
878 | dprintk("NFS: %4d initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n", | 874 | dprintk("NFS: %4d initiated write call (req %s/%Ld, %u bytes @ offset %Lu)\n", |
879 | data->task.tk_pid, | 875 | data->task.tk_pid, |
@@ -1131,9 +1127,9 @@ static void nfs_writeback_done_full(struct nfs_write_data *data, int status) | |||
1131 | /* | 1127 | /* |
1132 | * This function is called when the WRITE call is complete. | 1128 | * This function is called when the WRITE call is complete. |
1133 | */ | 1129 | */ |
1134 | void nfs_writeback_done(struct rpc_task *task) | 1130 | void nfs_writeback_done(struct rpc_task *task, void *calldata) |
1135 | { | 1131 | { |
1136 | struct nfs_write_data *data = (struct nfs_write_data *) task->tk_calldata; | 1132 | struct nfs_write_data *data = calldata; |
1137 | struct nfs_writeargs *argp = &data->args; | 1133 | struct nfs_writeargs *argp = &data->args; |
1138 | struct nfs_writeres *resp = &data->res; | 1134 | struct nfs_writeres *resp = &data->res; |
1139 | 1135 | ||
@@ -1200,9 +1196,8 @@ void nfs_writeback_done(struct rpc_task *task) | |||
1200 | 1196 | ||
1201 | 1197 | ||
1202 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) | 1198 | #if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) |
1203 | static void nfs_commit_release(struct rpc_task *task) | 1199 | void nfs_commit_release(void *wdata) |
1204 | { | 1200 | { |
1205 | struct nfs_write_data *wdata = (struct nfs_write_data *)task->tk_calldata; | ||
1206 | nfs_commit_free(wdata); | 1201 | nfs_commit_free(wdata); |
1207 | } | 1202 | } |
1208 | 1203 | ||
@@ -1238,9 +1233,6 @@ static void nfs_commit_rpcsetup(struct list_head *head, | |||
1238 | 1233 | ||
1239 | data->task.tk_priority = flush_task_priority(how); | 1234 | data->task.tk_priority = flush_task_priority(how); |
1240 | data->task.tk_cookie = (unsigned long)inode; | 1235 | data->task.tk_cookie = (unsigned long)inode; |
1241 | data->task.tk_calldata = data; | ||
1242 | /* Release requests */ | ||
1243 | data->task.tk_release = nfs_commit_release; | ||
1244 | 1236 | ||
1245 | dprintk("NFS: %4d initiated commit call\n", data->task.tk_pid); | 1237 | dprintk("NFS: %4d initiated commit call\n", data->task.tk_pid); |
1246 | } | 1238 | } |
@@ -1277,10 +1269,9 @@ nfs_commit_list(struct list_head *head, int how) | |||
1277 | /* | 1269 | /* |
1278 | * COMMIT call returned | 1270 | * COMMIT call returned |
1279 | */ | 1271 | */ |
1280 | void | 1272 | void nfs_commit_done(struct rpc_task *task, void *calldata) |
1281 | nfs_commit_done(struct rpc_task *task) | ||
1282 | { | 1273 | { |
1283 | struct nfs_write_data *data = (struct nfs_write_data *)task->tk_calldata; | 1274 | struct nfs_write_data *data = calldata; |
1284 | struct nfs_page *req; | 1275 | struct nfs_page *req; |
1285 | int res = 0; | 1276 | int res = 0; |
1286 | 1277 | ||