aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2012-04-20 14:47:39 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-04-27 14:10:37 -0400
commit0b7c01533aa9f4a228d07d2768d084acb3a387bc (patch)
treeaa57b08ce42f1effea2294354e3c9770b70e7612 /fs/nfs/direct.c
parent799ba8d53d32c84bd2a867ca2689538a48176140 (diff)
NFS: add a struct nfs_commit_data to replace nfs_write_data in commits
Commits don't need the vectors of pages, etc. that writes do. Split out a separate structure for the commit operation. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 8a8942326758..5897dfe48118 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -82,7 +82,7 @@ struct nfs_direct_req {
82 82
83 /* commit state */ 83 /* commit state */
84 struct list_head rewrite_list; /* saved nfs_write_data structs */ 84 struct list_head rewrite_list; /* saved nfs_write_data structs */
85 struct nfs_write_data * commit_data; /* special write_data for commits */ 85 struct nfs_commit_data *commit_data; /* special write_data for commits */
86 int flags; 86 int flags;
87#define NFS_ODIRECT_DO_COMMIT (1) /* an unstable reply was received */ 87#define NFS_ODIRECT_DO_COMMIT (1) /* an unstable reply was received */
88#define NFS_ODIRECT_RESCHED_WRITES (2) /* write verification failed */ 88#define NFS_ODIRECT_RESCHED_WRITES (2) /* write verification failed */
@@ -524,7 +524,7 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
524 524
525static void nfs_direct_commit_result(struct rpc_task *task, void *calldata) 525static void nfs_direct_commit_result(struct rpc_task *task, void *calldata)
526{ 526{
527 struct nfs_write_data *data = calldata; 527 struct nfs_commit_data *data = calldata;
528 528
529 /* Call the NFS version-specific code */ 529 /* Call the NFS version-specific code */
530 NFS_PROTO(data->inode)->commit_done(task, data); 530 NFS_PROTO(data->inode)->commit_done(task, data);
@@ -532,8 +532,8 @@ static void nfs_direct_commit_result(struct rpc_task *task, void *calldata)
532 532
533static void nfs_direct_commit_release(void *calldata) 533static void nfs_direct_commit_release(void *calldata)
534{ 534{
535 struct nfs_write_data *data = calldata; 535 struct nfs_commit_data *data = calldata;
536 struct nfs_direct_req *dreq = (struct nfs_direct_req *) data->req; 536 struct nfs_direct_req *dreq = data->dreq;
537 int status = data->task.tk_status; 537 int status = data->task.tk_status;
538 538
539 if (status < 0) { 539 if (status < 0) {
@@ -551,14 +551,14 @@ static void nfs_direct_commit_release(void *calldata)
551} 551}
552 552
553static const struct rpc_call_ops nfs_commit_direct_ops = { 553static const struct rpc_call_ops nfs_commit_direct_ops = {
554 .rpc_call_prepare = nfs_write_prepare, 554 .rpc_call_prepare = nfs_commit_prepare,
555 .rpc_call_done = nfs_direct_commit_result, 555 .rpc_call_done = nfs_direct_commit_result,
556 .rpc_release = nfs_direct_commit_release, 556 .rpc_release = nfs_direct_commit_release,
557}; 557};
558 558
559static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq) 559static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
560{ 560{
561 struct nfs_write_data *data = dreq->commit_data; 561 struct nfs_commit_data *data = dreq->commit_data;
562 struct rpc_task *task; 562 struct rpc_task *task;
563 struct rpc_message msg = { 563 struct rpc_message msg = {
564 .rpc_argp = &data->args, 564 .rpc_argp = &data->args,
@@ -581,9 +581,6 @@ static void nfs_direct_commit_schedule(struct nfs_direct_req *dreq)
581 data->args.fh = NFS_FH(data->inode); 581 data->args.fh = NFS_FH(data->inode);
582 data->args.offset = 0; 582 data->args.offset = 0;
583 data->args.count = 0; 583 data->args.count = 0;
584 data->args.context = dreq->ctx;
585 data->args.lock_context = dreq->l_ctx;
586 data->res.count = 0;
587 data->res.fattr = &data->fattr; 584 data->res.fattr = &data->fattr;
588 data->res.verf = &data->verf; 585 data->res.verf = &data->verf;
589 nfs_fattr_init(&data->fattr); 586 nfs_fattr_init(&data->fattr);
@@ -625,7 +622,7 @@ static void nfs_alloc_commit_data(struct nfs_direct_req *dreq)
625{ 622{
626 dreq->commit_data = nfs_commitdata_alloc(); 623 dreq->commit_data = nfs_commitdata_alloc();
627 if (dreq->commit_data != NULL) 624 if (dreq->commit_data != NULL)
628 dreq->commit_data->req = (struct nfs_page *) dreq; 625 dreq->commit_data->dreq = dreq;
629} 626}
630#else 627#else
631static inline void nfs_alloc_commit_data(struct nfs_direct_req *dreq) 628static inline void nfs_alloc_commit_data(struct nfs_direct_req *dreq)