aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2011-03-23 09:27:45 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-03-23 15:29:02 -0400
commit9ace33cdc6562699a780b4716d9d52c55dd2151a (patch)
tree911f8661b4565fbe2b870a8ab488ede32d2841e3 /fs/nfs/write.c
parent465d52437d5ce8d4eb9da0d3e3818b51cff163a1 (diff)
NFSv4.1: rearrange nfs_commit_rpcsetup
Reorder nfs_commit_rpcsetup, preparing for a pnfs entry point. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c60
1 files changed, 33 insertions, 27 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 92b4a6614fd3..bf672faa4885 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1293,32 +1293,49 @@ static void nfs_commitdata_release(void *data)
1293 nfs_commit_free(wdata); 1293 nfs_commit_free(wdata);
1294} 1294}
1295 1295
1296/* 1296static int nfs_initiate_commit(struct nfs_write_data *data, struct rpc_clnt *clnt,
1297 * Set up the argument/result storage required for the RPC call. 1297 const struct rpc_call_ops *call_ops,
1298 */ 1298 int how)
1299static int nfs_commit_rpcsetup(struct list_head *head,
1300 struct nfs_write_data *data,
1301 int how)
1302{ 1299{
1303 struct nfs_page *first = nfs_list_entry(head->next);
1304 struct inode *inode = first->wb_context->path.dentry->d_inode;
1305 int priority = flush_task_priority(how);
1306 struct rpc_task *task; 1300 struct rpc_task *task;
1301 int priority = flush_task_priority(how);
1307 struct rpc_message msg = { 1302 struct rpc_message msg = {
1308 .rpc_argp = &data->args, 1303 .rpc_argp = &data->args,
1309 .rpc_resp = &data->res, 1304 .rpc_resp = &data->res,
1310 .rpc_cred = first->wb_context->cred, 1305 .rpc_cred = data->cred,
1311 }; 1306 };
1312 struct rpc_task_setup task_setup_data = { 1307 struct rpc_task_setup task_setup_data = {
1313 .task = &data->task, 1308 .task = &data->task,
1314 .rpc_client = NFS_CLIENT(inode), 1309 .rpc_client = clnt,
1315 .rpc_message = &msg, 1310 .rpc_message = &msg,
1316 .callback_ops = &nfs_commit_ops, 1311 .callback_ops = call_ops,
1317 .callback_data = data, 1312 .callback_data = data,
1318 .workqueue = nfsiod_workqueue, 1313 .workqueue = nfsiod_workqueue,
1319 .flags = RPC_TASK_ASYNC, 1314 .flags = RPC_TASK_ASYNC,
1320 .priority = priority, 1315 .priority = priority,
1321 }; 1316 };
1317 /* Set up the initial task struct. */
1318 NFS_PROTO(data->inode)->commit_setup(data, &msg);
1319
1320 dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid);
1321
1322 task = rpc_run_task(&task_setup_data);
1323 if (IS_ERR(task))
1324 return PTR_ERR(task);
1325 if (how & FLUSH_SYNC)
1326 rpc_wait_for_completion_task(task);
1327 rpc_put_task(task);
1328 return 0;
1329}
1330
1331/*
1332 * Set up the argument/result storage required for the RPC call.
1333 */
1334static void nfs_init_commit(struct nfs_write_data *data,
1335 struct list_head *head)
1336{
1337 struct nfs_page *first = nfs_list_entry(head->next);
1338 struct inode *inode = first->wb_context->path.dentry->d_inode;
1322 1339
1323 /* Set up the RPC argument and reply structs 1340 /* Set up the RPC argument and reply structs
1324 * NB: take care not to mess about with data->commit et al. */ 1341 * NB: take care not to mess about with data->commit et al. */
@@ -1326,7 +1343,8 @@ static int nfs_commit_rpcsetup(struct list_head *head,
1326 list_splice_init(head, &data->pages); 1343 list_splice_init(head, &data->pages);
1327 1344
1328 data->inode = inode; 1345 data->inode = inode;
1329 data->cred = msg.rpc_cred; 1346 data->cred = first->wb_context->cred;
1347 data->mds_ops = &nfs_commit_ops;
1330 1348
1331 data->args.fh = NFS_FH(data->inode); 1349 data->args.fh = NFS_FH(data->inode);
1332 /* Note: we always request a commit of the entire inode */ 1350 /* Note: we always request a commit of the entire inode */
@@ -1337,19 +1355,6 @@ static int nfs_commit_rpcsetup(struct list_head *head,
1337 data->res.fattr = &data->fattr; 1355 data->res.fattr = &data->fattr;
1338 data->res.verf = &data->verf; 1356 data->res.verf = &data->verf;
1339 nfs_fattr_init(&data->fattr); 1357 nfs_fattr_init(&data->fattr);
1340
1341 /* Set up the initial task struct. */
1342 NFS_PROTO(inode)->commit_setup(data, &msg);
1343
1344 dprintk("NFS: %5u initiated commit call\n", data->task.tk_pid);
1345
1346 task = rpc_run_task(&task_setup_data);
1347 if (IS_ERR(task))
1348 return PTR_ERR(task);
1349 if (how & FLUSH_SYNC)
1350 rpc_wait_for_completion_task(task);
1351 rpc_put_task(task);
1352 return 0;
1353} 1358}
1354 1359
1355/* 1360/*
@@ -1367,7 +1372,8 @@ nfs_commit_list(struct inode *inode, struct list_head *head, int how)
1367 goto out_bad; 1372 goto out_bad;
1368 1373
1369 /* Set up the argument struct */ 1374 /* Set up the argument struct */
1370 return nfs_commit_rpcsetup(head, data, how); 1375 nfs_init_commit(data, head);
1376 return nfs_initiate_commit(data, NFS_CLIENT(inode), data->mds_ops, how);
1371 out_bad: 1377 out_bad:
1372 while (!list_empty(head)) { 1378 while (!list_empty(head)) {
1373 req = nfs_list_entry(head->next); 1379 req = nfs_list_entry(head->next);