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>
This commit is contained in:
committed by
Dave Chinner
parent
f8319483f5
commit
6552321831
@ -1251,13 +1251,11 @@ xfs_reflink_remap_range(
|
||||
return -EIO;
|
||||
|
||||
/* Lock both files against IO */
|
||||
if (same_inode) {
|
||||
xfs_ilock(src, XFS_IOLOCK_EXCL);
|
||||
lock_two_nondirectories(inode_in, inode_out);
|
||||
if (same_inode)
|
||||
xfs_ilock(src, XFS_MMAPLOCK_EXCL);
|
||||
} else {
|
||||
xfs_lock_two_inodes(src, dest, XFS_IOLOCK_EXCL);
|
||||
else
|
||||
xfs_lock_two_inodes(src, dest, XFS_MMAPLOCK_EXCL);
|
||||
}
|
||||
|
||||
/* Don't touch certain kinds of inodes */
|
||||
ret = -EPERM;
|
||||
@ -1402,11 +1400,9 @@ xfs_reflink_remap_range(
|
||||
|
||||
out_unlock:
|
||||
xfs_iunlock(src, XFS_MMAPLOCK_EXCL);
|
||||
xfs_iunlock(src, XFS_IOLOCK_EXCL);
|
||||
if (src->i_ino != dest->i_ino) {
|
||||
if (!same_inode)
|
||||
xfs_iunlock(dest, XFS_MMAPLOCK_EXCL);
|
||||
xfs_iunlock(dest, XFS_IOLOCK_EXCL);
|
||||
}
|
||||
unlock_two_nondirectories(inode_in, inode_out);
|
||||
if (ret)
|
||||
trace_xfs_reflink_remap_range_error(dest, ret, _RET_IP_);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user