aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-14 15:40:00 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:32 -0500
commitbdc7f021f3a1fade77adf3c2d7f65690566fddfe (patch)
treec076431ac83fc75cde00dc3d3a218fabae449980 /fs/nfs/nfs4proc.c
parentb3ef8b3bb93300e58a4c4806207de3de4eb76f48 (diff)
NFS: Clean up the (commit|read|write)_setup() callback routines
Move the common code for setting up the nfs_write_data and nfs_read_data structures into fs/nfs/read.c, fs/nfs/write.c and fs/nfs/direct.c. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c49
1 files changed, 8 insertions, 41 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ff2c5f83ce87..7c0baf23abdc 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2432,18 +2432,10 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
2432 return 0; 2432 return 0;
2433} 2433}
2434 2434
2435static void nfs4_proc_read_setup(struct nfs_read_data *data) 2435static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg)
2436{ 2436{
2437 struct rpc_message msg = {
2438 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ],
2439 .rpc_argp = &data->args,
2440 .rpc_resp = &data->res,
2441 .rpc_cred = data->cred,
2442 };
2443
2444 data->timestamp = jiffies; 2437 data->timestamp = jiffies;
2445 2438 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ];
2446 rpc_call_setup(&data->task, &msg, 0);
2447} 2439}
2448 2440
2449static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data) 2441static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
@@ -2461,33 +2453,15 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
2461 return 0; 2453 return 0;
2462} 2454}
2463 2455
2464static void nfs4_proc_write_setup(struct nfs_write_data *data, int how) 2456static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_message *msg)
2465{ 2457{
2466 struct rpc_message msg = { 2458 struct nfs_server *server = NFS_SERVER(data->inode);
2467 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE], 2459
2468 .rpc_argp = &data->args,
2469 .rpc_resp = &data->res,
2470 .rpc_cred = data->cred,
2471 };
2472 struct inode *inode = data->inode;
2473 struct nfs_server *server = NFS_SERVER(inode);
2474 int stable;
2475
2476 if (how & FLUSH_STABLE) {
2477 if (!NFS_I(inode)->ncommit)
2478 stable = NFS_FILE_SYNC;
2479 else
2480 stable = NFS_DATA_SYNC;
2481 } else
2482 stable = NFS_UNSTABLE;
2483 data->args.stable = stable;
2484 data->args.bitmask = server->attr_bitmask; 2460 data->args.bitmask = server->attr_bitmask;
2485 data->res.server = server; 2461 data->res.server = server;
2486
2487 data->timestamp = jiffies; 2462 data->timestamp = jiffies;
2488 2463
2489 /* Finalize the task. */ 2464 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE];
2490 rpc_call_setup(&data->task, &msg, 0);
2491} 2465}
2492 2466
2493static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data) 2467static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
@@ -2502,20 +2476,13 @@ static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
2502 return 0; 2476 return 0;
2503} 2477}
2504 2478
2505static void nfs4_proc_commit_setup(struct nfs_write_data *data, int how) 2479static void nfs4_proc_commit_setup(struct nfs_write_data *data, struct rpc_message *msg)
2506{ 2480{
2507 struct rpc_message msg = {
2508 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT],
2509 .rpc_argp = &data->args,
2510 .rpc_resp = &data->res,
2511 .rpc_cred = data->cred,
2512 };
2513 struct nfs_server *server = NFS_SERVER(data->inode); 2481 struct nfs_server *server = NFS_SERVER(data->inode);
2514 2482
2515 data->args.bitmask = server->attr_bitmask; 2483 data->args.bitmask = server->attr_bitmask;
2516 data->res.server = server; 2484 data->res.server = server;
2517 2485 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT];
2518 rpc_call_setup(&data->task, &msg, 0);
2519} 2486}
2520 2487
2521/* 2488/*