aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/unlink.c
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 /fs/nfs/unlink.c
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 'fs/nfs/unlink.c')
-rw-r--r--fs/nfs/unlink.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index d639d172d56..1494484ba86 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -116,10 +116,9 @@ nfs_async_unlink_init(struct rpc_task *task)
116 * 116 *
117 * Do the directory attribute update. 117 * Do the directory attribute update.
118 */ 118 */
119static void 119static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
120nfs_async_unlink_done(struct rpc_task *task)
121{ 120{
122 struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata; 121 struct nfs_unlinkdata *data = calldata;
123 struct dentry *dir = data->dir; 122 struct dentry *dir = data->dir;
124 struct inode *dir_i; 123 struct inode *dir_i;
125 124
@@ -141,13 +140,17 @@ nfs_async_unlink_done(struct rpc_task *task)
141 * We need to call nfs_put_unlinkdata as a 'tk_release' task since the 140 * We need to call nfs_put_unlinkdata as a 'tk_release' task since the
142 * rpc_task would be freed too. 141 * rpc_task would be freed too.
143 */ 142 */
144static void 143static void nfs_async_unlink_release(void *calldata)
145nfs_async_unlink_release(struct rpc_task *task)
146{ 144{
147 struct nfs_unlinkdata *data = (struct nfs_unlinkdata *)task->tk_calldata; 145 struct nfs_unlinkdata *data = calldata;
148 nfs_put_unlinkdata(data); 146 nfs_put_unlinkdata(data);
149} 147}
150 148
149static const struct rpc_call_ops nfs_unlink_ops = {
150 .rpc_call_done = nfs_async_unlink_done,
151 .rpc_release = nfs_async_unlink_release,
152};
153
151/** 154/**
152 * nfs_async_unlink - asynchronous unlinking of a file 155 * nfs_async_unlink - asynchronous unlinking of a file
153 * @dentry: dentry to unlink 156 * @dentry: dentry to unlink
@@ -179,10 +182,8 @@ nfs_async_unlink(struct dentry *dentry)
179 data->count = 1; 182 data->count = 1;
180 183
181 task = &data->task; 184 task = &data->task;
182 rpc_init_task(task, clnt, nfs_async_unlink_done , RPC_TASK_ASYNC); 185 rpc_init_task(task, clnt, RPC_TASK_ASYNC, &nfs_unlink_ops, data);
183 task->tk_calldata = data;
184 task->tk_action = nfs_async_unlink_init; 186 task->tk_action = nfs_async_unlink_init;
185 task->tk_release = nfs_async_unlink_release;
186 187
187 spin_lock(&dentry->d_lock); 188 spin_lock(&dentry->d_lock);
188 dentry->d_flags |= DCACHE_NFSFS_RENAMED; 189 dentry->d_flags |= DCACHE_NFSFS_RENAMED;