aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2012-04-20 14:47:57 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-04-27 14:10:39 -0400
commit1763da1234cba663b849476d451bdccac5147859 (patch)
treeb2b4bf3e1ce8624217c78508054fc620aac79a55 /fs/nfs/write.c
parent56f9cd684d25f1bae901c5a872b8427f8b417c3f (diff)
NFS: rewrite directio write to use async coalesce code
This also has the advantage that it allows directio to use pnfs. 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.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 56db9e7fa47..fec214bfa70 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -39,9 +39,6 @@
39/* 39/*
40 * Local function declarations 40 * Local function declarations
41 */ 41 */
42static void nfs_pageio_init_write(struct nfs_pageio_descriptor *desc,
43 struct inode *inode, int ioflags,
44 const struct nfs_pgio_completion_ops *compl_ops);
45static void nfs_redirty_request(struct nfs_page *req); 42static void nfs_redirty_request(struct nfs_page *req);
46static const struct rpc_call_ops nfs_write_common_ops; 43static const struct rpc_call_ops nfs_write_common_ops;
47static const struct rpc_call_ops nfs_commit_ops; 44static const struct rpc_call_ops nfs_commit_ops;
@@ -87,8 +84,8 @@ struct nfs_write_header *nfs_writehdr_alloc(void)
87 return p; 84 return p;
88} 85}
89 86
90struct nfs_write_data *nfs_writedata_alloc(struct nfs_pgio_header *hdr, 87static struct nfs_write_data *nfs_writedata_alloc(struct nfs_pgio_header *hdr,
91 unsigned int pagecount) 88 unsigned int pagecount)
92{ 89{
93 struct nfs_write_data *data, *prealloc; 90 struct nfs_write_data *data, *prealloc;
94 91
@@ -518,14 +515,17 @@ void nfs_init_cinfo(struct nfs_commit_info *cinfo,
518 struct inode *inode, 515 struct inode *inode,
519 struct nfs_direct_req *dreq) 516 struct nfs_direct_req *dreq)
520{ 517{
521 nfs_init_cinfo_from_inode(cinfo, inode); 518 if (dreq)
519 nfs_init_cinfo_from_dreq(cinfo, dreq);
520 else
521 nfs_init_cinfo_from_inode(cinfo, inode);
522} 522}
523EXPORT_SYMBOL_GPL(nfs_init_cinfo); 523EXPORT_SYMBOL_GPL(nfs_init_cinfo);
524 524
525/* 525/*
526 * Add a request to the inode's commit list. 526 * Add a request to the inode's commit list.
527 */ 527 */
528static void 528void
529nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, 529nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
530 struct nfs_commit_info *cinfo) 530 struct nfs_commit_info *cinfo)
531{ 531{
@@ -567,7 +567,7 @@ int nfs_write_need_commit(struct nfs_write_data *data)
567} 567}
568 568
569#else 569#else
570static void 570void
571nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, 571nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
572 struct nfs_commit_info *cinfo) 572 struct nfs_commit_info *cinfo)
573{ 573{
@@ -632,7 +632,7 @@ nfs_reqs_to_commit(struct nfs_commit_info *cinfo)
632} 632}
633 633
634/* cinfo->lock held by caller */ 634/* cinfo->lock held by caller */
635static int 635int
636nfs_scan_commit_list(struct list_head *src, struct list_head *dst, 636nfs_scan_commit_list(struct list_head *src, struct list_head *dst,
637 struct nfs_commit_info *cinfo, int max) 637 struct nfs_commit_info *cinfo, int max)
638{ 638{
@@ -647,7 +647,7 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst,
647 nfs_request_remove_commit_list(req, cinfo); 647 nfs_request_remove_commit_list(req, cinfo);
648 nfs_list_add_request(req, dst); 648 nfs_list_add_request(req, dst);
649 ret++; 649 ret++;
650 if (ret == max) 650 if ((ret == max) && !cinfo->dreq)
651 break; 651 break;
652 } 652 }
653 return ret; 653 return ret;
@@ -662,7 +662,7 @@ nfs_scan_commit_list(struct list_head *src, struct list_head *dst,
662 * Moves requests from the inode's 'commit' request list. 662 * Moves requests from the inode's 'commit' request list.
663 * The requests are *not* checked to ensure that they form a contiguous set. 663 * The requests are *not* checked to ensure that they form a contiguous set.
664 */ 664 */
665static int 665int
666nfs_scan_commit(struct inode *inode, struct list_head *dst, 666nfs_scan_commit(struct inode *inode, struct list_head *dst,
667 struct nfs_commit_info *cinfo) 667 struct nfs_commit_info *cinfo)
668{ 668{
@@ -686,8 +686,8 @@ static unsigned long nfs_reqs_to_commit(struct nfs_commit_info *cinfo)
686 return 0; 686 return 0;
687} 687}
688 688
689static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, 689int nfs_scan_commit(struct inode *inode, struct list_head *dst,
690 struct nfs_commit_info *cinfo) 690 struct nfs_commit_info *cinfo)
691{ 691{
692 return 0; 692 return 0;
693} 693}
@@ -1202,9 +1202,9 @@ void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio)
1202} 1202}
1203EXPORT_SYMBOL_GPL(nfs_pageio_reset_write_mds); 1203EXPORT_SYMBOL_GPL(nfs_pageio_reset_write_mds);
1204 1204
1205static void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, 1205void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
1206 struct inode *inode, int ioflags, 1206 struct inode *inode, int ioflags,
1207 const struct nfs_pgio_completion_ops *compl_ops) 1207 const struct nfs_pgio_completion_ops *compl_ops)
1208{ 1208{
1209 if (!pnfs_pageio_init_write(pgio, inode, ioflags, compl_ops)) 1209 if (!pnfs_pageio_init_write(pgio, inode, ioflags, compl_ops))
1210 nfs_pageio_init_write_mds(pgio, inode, ioflags, compl_ops); 1210 nfs_pageio_init_write_mds(pgio, inode, ioflags, compl_ops);
@@ -1568,8 +1568,8 @@ static const struct nfs_commit_completion_ops nfs_commit_completion_ops = {
1568 .error_cleanup = nfs_commit_clear_lock, 1568 .error_cleanup = nfs_commit_clear_lock,
1569}; 1569};
1570 1570
1571static int nfs_generic_commit_list(struct inode *inode, struct list_head *head, 1571int nfs_generic_commit_list(struct inode *inode, struct list_head *head,
1572 int how, struct nfs_commit_info *cinfo) 1572 int how, struct nfs_commit_info *cinfo)
1573{ 1573{
1574 int status; 1574 int status;
1575 1575