aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorWeston Andros Adamson <dros@primarydata.com>2014-06-09 11:48:36 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-06-24 18:47:00 -0400
commitc65e6254ca4db1584c5bf5f228ee26556477a9fd (patch)
treee182886537257fa1b9415bb911103fd9fa840024 /fs/nfs
parentd45f60c67848b9f19160692581d78e5b4757a000 (diff)
nfs: remove unused writeverf code
Remove duplicate writeverf structure from merge of nfs_pgio_header and nfs_pgio_data and remove writeverf related flags and logic to handle more than one RPC per nfs_pgio_header. Signed-off-by: Weston Andros Adamson <dros@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/blocklayout/blocklayout.c2
-rw-r--r--fs/nfs/direct.c25
-rw-r--r--fs/nfs/internal.h1
-rw-r--r--fs/nfs/objlayout/objlayout.c4
-rw-r--r--fs/nfs/pagelist.c2
-rw-r--r--fs/nfs/write.c27
6 files changed, 18 insertions, 43 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index c3ccfe440390..04ac32b339f8 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -445,7 +445,7 @@ static void bl_end_par_io_write(void *data, int num_se)
445 } 445 }
446 446
447 hdr->task.tk_status = hdr->pnfs_error; 447 hdr->task.tk_status = hdr->pnfs_error;
448 hdr->writeverf.committed = NFS_FILE_SYNC; 448 hdr->verf.committed = NFS_FILE_SYNC;
449 INIT_WORK(&hdr->task.u.tk_work, bl_write_cleanup); 449 INIT_WORK(&hdr->task.u.tk_work, bl_write_cleanup);
450 schedule_work(&hdr->task.u.tk_work); 450 schedule_work(&hdr->task.u.tk_work);
451} 451}
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 6c4c867ee04c..2a3293a5dda0 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -715,7 +715,7 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
715{ 715{
716 struct nfs_direct_req *dreq = hdr->dreq; 716 struct nfs_direct_req *dreq = hdr->dreq;
717 struct nfs_commit_info cinfo; 717 struct nfs_commit_info cinfo;
718 int bit = -1; 718 bool request_commit = false;
719 struct nfs_page *req = nfs_list_entry(hdr->pages.next); 719 struct nfs_page *req = nfs_list_entry(hdr->pages.next);
720 720
721 if (test_bit(NFS_IOHDR_REDO, &hdr->flags)) 721 if (test_bit(NFS_IOHDR_REDO, &hdr->flags))
@@ -729,27 +729,20 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
729 dreq->flags = 0; 729 dreq->flags = 0;
730 dreq->error = hdr->error; 730 dreq->error = hdr->error;
731 } 731 }
732 if (dreq->error != 0) 732 if (dreq->error == 0) {
733 bit = NFS_IOHDR_ERROR;
734 else {
735 dreq->count += hdr->good_bytes; 733 dreq->count += hdr->good_bytes;
736 if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags)) { 734 if (nfs_write_need_commit(hdr)) {
737 dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
738 bit = NFS_IOHDR_NEED_RESCHED;
739 } else if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) {
740 if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES) 735 if (dreq->flags == NFS_ODIRECT_RESCHED_WRITES)
741 bit = NFS_IOHDR_NEED_RESCHED; 736 request_commit = true;
742 else if (dreq->flags == 0) { 737 else if (dreq->flags == 0) {
743 nfs_direct_set_hdr_verf(dreq, hdr); 738 nfs_direct_set_hdr_verf(dreq, hdr);
744 bit = NFS_IOHDR_NEED_COMMIT; 739 request_commit = true;
745 dreq->flags = NFS_ODIRECT_DO_COMMIT; 740 dreq->flags = NFS_ODIRECT_DO_COMMIT;
746 } else if (dreq->flags == NFS_ODIRECT_DO_COMMIT) { 741 } else if (dreq->flags == NFS_ODIRECT_DO_COMMIT) {
747 if (nfs_direct_set_or_cmp_hdr_verf(dreq, hdr)) { 742 request_commit = true;
743 if (nfs_direct_set_or_cmp_hdr_verf(dreq, hdr))
748 dreq->flags = 744 dreq->flags =
749 NFS_ODIRECT_RESCHED_WRITES; 745 NFS_ODIRECT_RESCHED_WRITES;
750 bit = NFS_IOHDR_NEED_RESCHED;
751 } else
752 bit = NFS_IOHDR_NEED_COMMIT;
753 } 746 }
754 } 747 }
755 } 748 }
@@ -760,9 +753,7 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)
760 753
761 req = nfs_list_entry(hdr->pages.next); 754 req = nfs_list_entry(hdr->pages.next);
762 nfs_list_remove_request(req); 755 nfs_list_remove_request(req);
763 switch (bit) { 756 if (request_commit) {
764 case NFS_IOHDR_NEED_RESCHED:
765 case NFS_IOHDR_NEED_COMMIT:
766 kref_get(&req->wb_kref); 757 kref_get(&req->wb_kref);
767 nfs_mark_request_commit(req, hdr->lseg, &cinfo); 758 nfs_mark_request_commit(req, hdr->lseg, &cinfo);
768 do_destroy = false; 759 do_destroy = false;
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 3f3aedd2e8c9..da36257628c5 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -441,6 +441,7 @@ int nfs_scan_commit(struct inode *inode, struct list_head *dst,
441void nfs_mark_request_commit(struct nfs_page *req, 441void nfs_mark_request_commit(struct nfs_page *req,
442 struct pnfs_layout_segment *lseg, 442 struct pnfs_layout_segment *lseg,
443 struct nfs_commit_info *cinfo); 443 struct nfs_commit_info *cinfo);
444int nfs_write_need_commit(struct nfs_pgio_header *);
444int nfs_generic_commit_list(struct inode *inode, struct list_head *head, 445int nfs_generic_commit_list(struct inode *inode, struct list_head *head,
445 int how, struct nfs_commit_info *cinfo); 446 int how, struct nfs_commit_info *cinfo);
446void nfs_retry_commit(struct list_head *page_list, 447void nfs_retry_commit(struct list_head *page_list,
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c
index 86312787cee6..697a16d11fac 100644
--- a/fs/nfs/objlayout/objlayout.c
+++ b/fs/nfs/objlayout/objlayout.c
@@ -328,7 +328,7 @@ objlayout_write_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
328 oir->status = hdr->task.tk_status = status; 328 oir->status = hdr->task.tk_status = status;
329 if (status >= 0) { 329 if (status >= 0) {
330 hdr->res.count = status; 330 hdr->res.count = status;
331 hdr->writeverf.committed = oir->committed; 331 hdr->verf.committed = oir->committed;
332 } else { 332 } else {
333 hdr->pnfs_error = status; 333 hdr->pnfs_error = status;
334 } 334 }
@@ -336,7 +336,7 @@ objlayout_write_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
336 /* must not use oir after this point */ 336 /* must not use oir after this point */
337 337
338 dprintk("%s: Return status %zd committed %d sync=%d\n", __func__, 338 dprintk("%s: Return status %zd committed %d sync=%d\n", __func__,
339 status, hdr->writeverf.committed, sync); 339 status, hdr->verf.committed, sync);
340 340
341 if (sync) 341 if (sync)
342 pnfs_ld_write_done(hdr); 342 pnfs_ld_write_done(hdr);
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index ecb3d4cdbc85..7dd0d5f101a4 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -545,7 +545,7 @@ static void nfs_pgio_rpcsetup(struct nfs_pgio_header *hdr,
545 hdr->res.fattr = &hdr->fattr; 545 hdr->res.fattr = &hdr->fattr;
546 hdr->res.count = count; 546 hdr->res.count = count;
547 hdr->res.eof = 0; 547 hdr->res.eof = 0;
548 hdr->res.verf = &hdr->writeverf; 548 hdr->res.verf = &hdr->verf;
549 nfs_fattr_init(&hdr->fattr); 549 nfs_fattr_init(&hdr->fattr);
550} 550}
551 551
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 6a2d0986a3a3..8534ee5c207d 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -595,12 +595,11 @@ nfs_clear_request_commit(struct nfs_page *req)
595 } 595 }
596} 596}
597 597
598static inline
599int nfs_write_need_commit(struct nfs_pgio_header *hdr) 598int nfs_write_need_commit(struct nfs_pgio_header *hdr)
600{ 599{
601 if (hdr->writeverf.committed == NFS_DATA_SYNC) 600 if (hdr->verf.committed == NFS_DATA_SYNC)
602 return hdr->lseg == NULL; 601 return hdr->lseg == NULL;
603 return hdr->writeverf.committed != NFS_FILE_SYNC; 602 return hdr->verf.committed != NFS_FILE_SYNC;
604} 603}
605 604
606#else 605#else
@@ -626,7 +625,6 @@ nfs_clear_request_commit(struct nfs_page *req)
626{ 625{
627} 626}
628 627
629static inline
630int nfs_write_need_commit(struct nfs_pgio_header *hdr) 628int nfs_write_need_commit(struct nfs_pgio_header *hdr)
631{ 629{
632 return 0; 630 return 0;
@@ -654,11 +652,7 @@ static void nfs_write_completion(struct nfs_pgio_header *hdr)
654 nfs_context_set_write_error(req->wb_context, hdr->error); 652 nfs_context_set_write_error(req->wb_context, hdr->error);
655 goto remove_req; 653 goto remove_req;
656 } 654 }
657 if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags)) { 655 if (nfs_write_need_commit(hdr)) {
658 nfs_mark_request_dirty(req);
659 goto next;
660 }
661 if (test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags)) {
662 memcpy(&req->wb_verf, &hdr->verf.verifier, sizeof(req->wb_verf)); 656 memcpy(&req->wb_verf, &hdr->verf.verifier, sizeof(req->wb_verf));
663 nfs_mark_request_commit(req, hdr->lseg, &cinfo); 657 nfs_mark_request_commit(req, hdr->lseg, &cinfo);
664 goto next; 658 goto next;
@@ -668,7 +662,7 @@ remove_req:
668next: 662next:
669 nfs_unlock_request(req); 663 nfs_unlock_request(req);
670 nfs_end_page_writeback(req); 664 nfs_end_page_writeback(req);
671 do_destroy = !test_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags); 665 do_destroy = !nfs_write_need_commit(hdr);
672 nfs_release_request(req); 666 nfs_release_request(req);
673 } 667 }
674out: 668out:
@@ -1088,18 +1082,7 @@ void nfs_commit_prepare(struct rpc_task *task, void *calldata)
1088 1082
1089static void nfs_writeback_release_common(struct nfs_pgio_header *hdr) 1083static void nfs_writeback_release_common(struct nfs_pgio_header *hdr)
1090{ 1084{
1091 int status = hdr->task.tk_status; 1085 /* do nothing! */
1092
1093 if ((status >= 0) && nfs_write_need_commit(hdr)) {
1094 spin_lock(&hdr->lock);
1095 if (test_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags))
1096 ; /* Do nothing */
1097 else if (!test_and_set_bit(NFS_IOHDR_NEED_COMMIT, &hdr->flags))
1098 memcpy(&hdr->verf, &hdr->writeverf, sizeof(hdr->verf));
1099 else if (memcmp(&hdr->verf, &hdr->writeverf, sizeof(hdr->verf)))
1100 set_bit(NFS_IOHDR_NEED_RESCHED, &hdr->flags);
1101 spin_unlock(&hdr->lock);
1102 }
1103} 1086}
1104 1087
1105/* 1088/*