aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iops.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-11-29 22:33:25 -0500
committerDave Chinner <david@fromorbit.com>2016-11-29 22:33:25 -0500
commit6552321831dce87ff5c466a55b58d472732caadc (patch)
tree84f3de7b89690c84fd13e2efa7a85d4918d342e3 /fs/xfs/xfs_iops.c
parentf8319483f57f1ca22370f4150bb990aca7728a67 (diff)
xfs: remove i_iolock and use i_rwsem in the VFS inode instead
This patch drops the XFS-own i_iolock and uses the VFS i_rwsem which recently replaced i_mutex instead. This means we only have to take one lock instead of two in many fast path operations, and we can also shrink the xfs_inode structure. Thanks to the xfs_ilock family there is very little churn, the only thing of note is that we need to switch to use the lock_two_directory helper for taking the i_rwsem on two inodes in a few places to make sure our lock order matches the one used in the VFS. Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Jens Axboe <axboe@fb.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_iops.c')
-rw-r--r--fs/xfs/xfs_iops.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 405a65cd9d6b..c962999a87ab 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -983,15 +983,13 @@ xfs_vn_setattr(
983 struct xfs_inode *ip = XFS_I(d_inode(dentry)); 983 struct xfs_inode *ip = XFS_I(d_inode(dentry));
984 uint iolock = XFS_IOLOCK_EXCL; 984 uint iolock = XFS_IOLOCK_EXCL;
985 985
986 xfs_ilock(ip, iolock); 986 error = xfs_break_layouts(d_inode(dentry), &iolock);
987 error = xfs_break_layouts(d_inode(dentry), &iolock, true); 987 if (error)
988 if (!error) { 988 return error;
989 xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
990 iolock |= XFS_MMAPLOCK_EXCL;
991 989
992 error = xfs_vn_setattr_size(dentry, iattr); 990 xfs_ilock(ip, XFS_MMAPLOCK_EXCL);
993 } 991 error = xfs_setattr_size(ip, iattr);
994 xfs_iunlock(ip, iolock); 992 xfs_iunlock(ip, XFS_MMAPLOCK_EXCL);
995 } else { 993 } else {
996 error = xfs_vn_setattr_nonsize(dentry, iattr); 994 error = xfs_vn_setattr_nonsize(dentry, iattr);
997 } 995 }