summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2017-07-17 09:30:13 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2017-08-15 11:54:46 -0400
commit82749dd4efcec8e90fa7769eec3dd0afa2e3396a (patch)
tree0e8c3f768d8ab4e91944893624dcb73ef8e557e7 /fs
parent6d17d653c9f152e113043d00f3bcf00c0eb5f5a2 (diff)
downloadop-kernel-dev-82749dd4efcec8e90fa7769eec3dd0afa2e3396a.zip
op-kernel-dev-82749dd4efcec8e90fa7769eec3dd0afa2e3396a.tar.gz
NFS: Reduce lock contention in nfs_page_find_head_request()
Add a lockless check for whether or not the page might be carrying an existing writeback before we grab the inode->i_lock. Reported-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/write.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 1d447e37..06e150c 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -190,9 +190,11 @@ static struct nfs_page *nfs_page_find_head_request(struct page *page)
struct inode *inode = page_file_mapping(page)->host;
struct nfs_page *req = NULL;
- spin_lock(&inode->i_lock);
- req = nfs_page_find_head_request_locked(NFS_I(inode), page);
- spin_unlock(&inode->i_lock);
+ if (PagePrivate(page) || PageSwapCache(page)) {
+ spin_lock(&inode->i_lock);
+ req = nfs_page_find_head_request_locked(NFS_I(inode), page);
+ spin_unlock(&inode->i_lock);
+ }
return req;
}
OpenPOWER on IntegriCloud