summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4file.c
diff options
context:
space:
mode:
authorAnna Schumaker2015-03-16 19:06:24 +0100
committerTrond Myklebust2015-04-23 20:36:28 +0200
commitf830f7ddd9165c8bd69127458627f03df4b1a406 (patch)
treefb92b7097ce59629094ea59e0cc3a1cf0acf14be /fs/nfs/nfs4file.c
parentNFS: Don't zap caches on fallocate() (diff)
downloadkernel-qcow2-linux-f830f7ddd9165c8bd69127458627f03df4b1a406.tar.gz
kernel-qcow2-linux-f830f7ddd9165c8bd69127458627f03df4b1a406.tar.xz
kernel-qcow2-linux-f830f7ddd9165c8bd69127458627f03df4b1a406.zip
NFS: Reduce time spent holding the i_mutex during fallocate()
At the very least, we should not be taking the i_mutex until after checking if the server even supports ALLOCATE or DEALLOCATE, allowing v4.0 or v4.1 to exit without potentially waiting on a lock. Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/nfs4file.c')
-rw-r--r--fs/nfs/nfs4file.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 151ddff624d4..cb3c7879e59f 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -158,14 +158,9 @@ static long nfs42_fallocate(struct file *filep, int mode, loff_t offset, loff_t
if (ret < 0)
return ret;
- mutex_lock(&inode->i_mutex);
if (mode & FALLOC_FL_PUNCH_HOLE)
- ret = nfs42_proc_deallocate(filep, offset, len);
- else
- ret = nfs42_proc_allocate(filep, offset, len);
- mutex_unlock(&inode->i_mutex);
-
- return ret;
+ return nfs42_proc_deallocate(filep, offset, len);
+ return nfs42_proc_allocate(filep, offset, len);
}
#endif /* CONFIG_NFS_V4_2 */