aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-08-05 13:26:31 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-08-07 17:07:40 -0400
commitf8806c843f88a6b7d657cf24c3682bc2efda6fdb (patch)
tree6ac028b704a1f3c78f7dc98cc5fbf1de5e3a543c /fs/nfs
parent786615bc1ce84150ded80daea6bd9f6297f48e73 (diff)
NFS: Fix writeback performance issue on cache invalidation
If a cache invalidation is triggered, and we happen to have a lot of writebacks cached at the time, then the call to invalidate_inode_pages2() will end up calling ->launder_page() on each and every dirty page in order to sync its contents to disk, thus defeating write coalescing. The following patch ensures that we try to sync the inode to disk before calling invalidate_inode_pages2() so that we do the writeback as efficiently as possible. Reported-by: William Dauchy <william@gandi.net> Reported-by: Pascal Bouchareine <pascal@gandi.net> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> Tested-by: William Dauchy <william@gandi.net> Reviewed-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/inode.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index af6e806044d7..3ea4f641effc 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -963,9 +963,15 @@ EXPORT_SYMBOL_GPL(nfs_revalidate_inode);
963static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping) 963static int nfs_invalidate_mapping(struct inode *inode, struct address_space *mapping)
964{ 964{
965 struct nfs_inode *nfsi = NFS_I(inode); 965 struct nfs_inode *nfsi = NFS_I(inode);
966 966 int ret;
967
967 if (mapping->nrpages != 0) { 968 if (mapping->nrpages != 0) {
968 int ret = invalidate_inode_pages2(mapping); 969 if (S_ISREG(inode->i_mode)) {
970 ret = nfs_sync_mapping(mapping);
971 if (ret < 0)
972 return ret;
973 }
974 ret = invalidate_inode_pages2(mapping);
969 if (ret < 0) 975 if (ret < 0)
970 return ret; 976 return ret;
971 } 977 }