summaryrefslogtreecommitdiffstats
path: root/fs/nfs/write.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2011-06-10 13:30:23 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-12 13:40:28 -0400
commit1751c3638f2a07a8c66a803a31791bab9bd3fced (patch)
tree5c1f39f879c0a0049c50b4f36a256ba1986d82b2 /fs/nfs/write.c
parentf062eb6ced3b297277b94b4da3113b1d3782e539 (diff)
NFS: Cleanup of the nfs_pageio code in preparation for a pnfs bugfix
We need to ensure that the layouts are set up before we can decide to coalesce requests. To do so, we want to further split up the struct nfs_pageio_descriptor operations into an initialisation callback, a coalescing test callback, and a 'do i/o' callback. This patch cleans up the existing callback methods before adding the 'initialisation' callback. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/write.c')
-rw-r--r--fs/nfs/write.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 727168059684..b144b5474546 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1033,15 +1033,31 @@ out:
1033 return ret; 1033 return ret;
1034} 1034}
1035 1035
1036static void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, 1036int nfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc)
1037{
1038 if (desc->pg_bsize < PAGE_CACHE_SIZE)
1039 return nfs_flush_multi(desc);
1040 return nfs_flush_one(desc);
1041}
1042EXPORT_SYMBOL_GPL(nfs_generic_pg_writepages);
1043
1044static const struct nfs_pageio_ops nfs_pageio_write_ops = {
1045 .pg_test = nfs_generic_pg_test,
1046 .pg_doio = nfs_generic_pg_writepages,
1047};
1048
1049static void nfs_pageio_init_write_mds(struct nfs_pageio_descriptor *pgio,
1037 struct inode *inode, int ioflags) 1050 struct inode *inode, int ioflags)
1038{ 1051{
1039 size_t wsize = NFS_SERVER(inode)->wsize; 1052 nfs_pageio_init(pgio, inode, &nfs_pageio_write_ops,
1053 NFS_SERVER(inode)->wsize, ioflags);
1054}
1040 1055
1041 if (wsize < PAGE_CACHE_SIZE) 1056static void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
1042 nfs_pageio_init(pgio, inode, nfs_flush_multi, wsize, ioflags); 1057 struct inode *inode, int ioflags)
1043 else 1058{
1044 nfs_pageio_init(pgio, inode, nfs_flush_one, wsize, ioflags); 1059 if (!pnfs_pageio_init_write(pgio, inode, ioflags))
1060 nfs_pageio_init_write_mds(pgio, inode, ioflags);
1045} 1061}
1046 1062
1047/* 1063/*