From: Trond Myklebust Date: Mon, 17 Jul 2017 13:30:13 +0000 (-0400) Subject: NFS: Reduce lock contention in nfs_page_find_head_request() X-Git-Tag: MMI-PSA29.97-13-9~4705^2~17^2~29 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=82749dd4efcec8e90fa7769eec3dd0afa2e3396a;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Signed-off-by: Trond Myklebust --- diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 1d447e37f472..06e150c4e315 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; }