aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-14 15:39:59 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:30 -0500
commitc970aa85e71bd581726c42df843f6f129db275ac (patch)
treee7fc90ee4064196d357045fd173764e0b8fc8ca8 /fs/nfs
parent84115e1cd4a3614c4e566d4cce31381dce3dbef9 (diff)
SUNRPC: Clean up rpc_run_task
Make it use the new task initialiser structure instead of acting as a wrapper. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4proc.c49
-rw-r--r--fs/nfs/unlink.c9
2 files changed, 50 insertions, 8 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a51a7537f3f6..ff2c5f83ce87 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -779,12 +779,18 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
779{ 779{
780 struct nfs_server *server = NFS_SERVER(data->dir->d_inode); 780 struct nfs_server *server = NFS_SERVER(data->dir->d_inode);
781 struct rpc_task *task; 781 struct rpc_task *task;
782 struct rpc_task_setup task_setup_data = {
783 .rpc_client = server->client,
784 .callback_ops = &nfs4_open_confirm_ops,
785 .callback_data = data,
786 .flags = RPC_TASK_ASYNC,
787 };
782 int status; 788 int status;
783 789
784 kref_get(&data->kref); 790 kref_get(&data->kref);
785 data->rpc_done = 0; 791 data->rpc_done = 0;
786 data->rpc_status = 0; 792 data->rpc_status = 0;
787 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_confirm_ops, data); 793 task = rpc_run_task(&task_setup_data);
788 if (IS_ERR(task)) 794 if (IS_ERR(task))
789 return PTR_ERR(task); 795 return PTR_ERR(task);
790 status = nfs4_wait_for_completion_rpc_task(task); 796 status = nfs4_wait_for_completion_rpc_task(task);
@@ -908,13 +914,19 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
908 struct nfs_openargs *o_arg = &data->o_arg; 914 struct nfs_openargs *o_arg = &data->o_arg;
909 struct nfs_openres *o_res = &data->o_res; 915 struct nfs_openres *o_res = &data->o_res;
910 struct rpc_task *task; 916 struct rpc_task *task;
917 struct rpc_task_setup task_setup_data = {
918 .rpc_client = server->client,
919 .callback_ops = &nfs4_open_ops,
920 .callback_data = data,
921 .flags = RPC_TASK_ASYNC,
922 };
911 int status; 923 int status;
912 924
913 kref_get(&data->kref); 925 kref_get(&data->kref);
914 data->rpc_done = 0; 926 data->rpc_done = 0;
915 data->rpc_status = 0; 927 data->rpc_status = 0;
916 data->cancelled = 0; 928 data->cancelled = 0;
917 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_open_ops, data); 929 task = rpc_run_task(&task_setup_data);
918 if (IS_ERR(task)) 930 if (IS_ERR(task))
919 return PTR_ERR(task); 931 return PTR_ERR(task);
920 status = nfs4_wait_for_completion_rpc_task(task); 932 status = nfs4_wait_for_completion_rpc_task(task);
@@ -1309,6 +1321,11 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
1309 struct nfs4_closedata *calldata; 1321 struct nfs4_closedata *calldata;
1310 struct nfs4_state_owner *sp = state->owner; 1322 struct nfs4_state_owner *sp = state->owner;
1311 struct rpc_task *task; 1323 struct rpc_task *task;
1324 struct rpc_task_setup task_setup_data = {
1325 .rpc_client = server->client,
1326 .callback_ops = &nfs4_close_ops,
1327 .flags = RPC_TASK_ASYNC,
1328 };
1312 int status = -ENOMEM; 1329 int status = -ENOMEM;
1313 1330
1314 calldata = kmalloc(sizeof(*calldata), GFP_KERNEL); 1331 calldata = kmalloc(sizeof(*calldata), GFP_KERNEL);
@@ -1328,7 +1345,8 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
1328 calldata->path.mnt = mntget(path->mnt); 1345 calldata->path.mnt = mntget(path->mnt);
1329 calldata->path.dentry = dget(path->dentry); 1346 calldata->path.dentry = dget(path->dentry);
1330 1347
1331 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata); 1348 task_setup_data.callback_data = calldata;
1349 task = rpc_run_task(&task_setup_data);
1332 if (IS_ERR(task)) 1350 if (IS_ERR(task))
1333 return PTR_ERR(task); 1351 return PTR_ERR(task);
1334 status = 0; 1352 status = 0;
@@ -3027,6 +3045,11 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co
3027 struct nfs4_delegreturndata *data; 3045 struct nfs4_delegreturndata *data;
3028 struct nfs_server *server = NFS_SERVER(inode); 3046 struct nfs_server *server = NFS_SERVER(inode);
3029 struct rpc_task *task; 3047 struct rpc_task *task;
3048 struct rpc_task_setup task_setup_data = {
3049 .rpc_client = server->client,
3050 .callback_ops = &nfs4_delegreturn_ops,
3051 .flags = RPC_TASK_ASYNC,
3052 };
3030 int status; 3053 int status;
3031 3054
3032 data = kmalloc(sizeof(*data), GFP_KERNEL); 3055 data = kmalloc(sizeof(*data), GFP_KERNEL);
@@ -3043,7 +3066,8 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co
3043 data->timestamp = jiffies; 3066 data->timestamp = jiffies;
3044 data->rpc_status = 0; 3067 data->rpc_status = 0;
3045 3068
3046 task = rpc_run_task(NFS_CLIENT(inode), RPC_TASK_ASYNC, &nfs4_delegreturn_ops, data); 3069 task_setup_data.callback_data = data;
3070 task = rpc_run_task(&task_setup_data);
3047 if (IS_ERR(task)) 3071 if (IS_ERR(task))
3048 return PTR_ERR(task); 3072 return PTR_ERR(task);
3049 status = nfs4_wait_for_completion_rpc_task(task); 3073 status = nfs4_wait_for_completion_rpc_task(task);
@@ -3260,6 +3284,11 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
3260 struct nfs_seqid *seqid) 3284 struct nfs_seqid *seqid)
3261{ 3285{
3262 struct nfs4_unlockdata *data; 3286 struct nfs4_unlockdata *data;
3287 struct rpc_task_setup task_setup_data = {
3288 .rpc_client = NFS_CLIENT(lsp->ls_state->inode),
3289 .callback_ops = &nfs4_locku_ops,
3290 .flags = RPC_TASK_ASYNC,
3291 };
3263 3292
3264 /* Ensure this is an unlock - when canceling a lock, the 3293 /* Ensure this is an unlock - when canceling a lock, the
3265 * canceled lock is passed in, and it won't be an unlock. 3294 * canceled lock is passed in, and it won't be an unlock.
@@ -3272,7 +3301,8 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
3272 return ERR_PTR(-ENOMEM); 3301 return ERR_PTR(-ENOMEM);
3273 } 3302 }
3274 3303
3275 return rpc_run_task(NFS_CLIENT(lsp->ls_state->inode), RPC_TASK_ASYNC, &nfs4_locku_ops, data); 3304 task_setup_data.callback_data = data;
3305 return rpc_run_task(&task_setup_data);
3276} 3306}
3277 3307
3278static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request) 3308static int nfs4_proc_unlck(struct nfs4_state *state, int cmd, struct file_lock *request)
@@ -3438,6 +3468,11 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
3438{ 3468{
3439 struct nfs4_lockdata *data; 3469 struct nfs4_lockdata *data;
3440 struct rpc_task *task; 3470 struct rpc_task *task;
3471 struct rpc_task_setup task_setup_data = {
3472 .rpc_client = NFS_CLIENT(state->inode),
3473 .callback_ops = &nfs4_lock_ops,
3474 .flags = RPC_TASK_ASYNC,
3475 };
3441 int ret; 3476 int ret;
3442 3477
3443 dprintk("%s: begin!\n", __FUNCTION__); 3478 dprintk("%s: begin!\n", __FUNCTION__);
@@ -3449,8 +3484,8 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
3449 data->arg.block = 1; 3484 data->arg.block = 1;
3450 if (reclaim != 0) 3485 if (reclaim != 0)
3451 data->arg.reclaim = 1; 3486 data->arg.reclaim = 1;
3452 task = rpc_run_task(NFS_CLIENT(state->inode), RPC_TASK_ASYNC, 3487 task_setup_data.callback_data = data;
3453 &nfs4_lock_ops, data); 3488 task = rpc_run_task(&task_setup_data);
3454 if (IS_ERR(task)) 3489 if (IS_ERR(task))
3455 return PTR_ERR(task); 3490 return PTR_ERR(task);
3456 ret = nfs4_wait_for_completion_rpc_task(task); 3491 ret = nfs4_wait_for_completion_rpc_task(task);
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 8e5428e0b86f..6660d9a53345 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -127,6 +127,11 @@ static const struct rpc_call_ops nfs_unlink_ops = {
127 127
128static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data) 128static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data)
129{ 129{
130 struct rpc_task_setup task_setup_data = {
131 .callback_ops = &nfs_unlink_ops,
132 .callback_data = data,
133 .flags = RPC_TASK_ASYNC,
134 };
130 struct rpc_task *task; 135 struct rpc_task *task;
131 struct dentry *alias; 136 struct dentry *alias;
132 137
@@ -160,7 +165,9 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n
160 data->args.fh = NFS_FH(dir); 165 data->args.fh = NFS_FH(dir);
161 nfs_fattr_init(&data->res.dir_attr); 166 nfs_fattr_init(&data->res.dir_attr);
162 167
163 task = rpc_run_task(NFS_CLIENT(dir), RPC_TASK_ASYNC, &nfs_unlink_ops, data); 168 task_setup_data.rpc_client = NFS_CLIENT(dir);
169
170 task = rpc_run_task(&task_setup_data);
164 if (!IS_ERR(task)) 171 if (!IS_ERR(task))
165 rpc_put_task(task); 172 rpc_put_task(task);
166 return 1; 173 return 1;