diff options
author | Christoph Hellwig <hch@lst.de> | 2016-11-29 22:33:25 -0500 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-11-29 22:33:25 -0500 |
commit | 6552321831dce87ff5c466a55b58d472732caadc (patch) | |
tree | 84f3de7b89690c84fd13e2efa7a85d4918d342e3 /fs/xfs/xfs_aops.c | |
parent | f8319483f57f1ca22370f4150bb990aca7728a67 (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_aops.c')
-rw-r--r-- | fs/xfs/xfs_aops.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index ab266d66124d..e8f6c2bcd4a4 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -1585,7 +1585,6 @@ xfs_vm_bmap( | |||
1585 | struct xfs_inode *ip = XFS_I(inode); | 1585 | struct xfs_inode *ip = XFS_I(inode); |
1586 | 1586 | ||
1587 | trace_xfs_vm_bmap(XFS_I(inode)); | 1587 | trace_xfs_vm_bmap(XFS_I(inode)); |
1588 | xfs_ilock(ip, XFS_IOLOCK_SHARED); | ||
1589 | 1588 | ||
1590 | /* | 1589 | /* |
1591 | * The swap code (ab-)uses ->bmap to get a block mapping and then | 1590 | * The swap code (ab-)uses ->bmap to get a block mapping and then |
@@ -1593,12 +1592,10 @@ xfs_vm_bmap( | |||
1593 | * that on reflinks inodes, so we have to skip out here. And yes, | 1592 | * that on reflinks inodes, so we have to skip out here. And yes, |
1594 | * 0 is the magic code for a bmap error.. | 1593 | * 0 is the magic code for a bmap error.. |
1595 | */ | 1594 | */ |
1596 | if (xfs_is_reflink_inode(ip)) { | 1595 | if (xfs_is_reflink_inode(ip)) |
1597 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | ||
1598 | return 0; | 1596 | return 0; |
1599 | } | 1597 | |
1600 | filemap_write_and_wait(mapping); | 1598 | filemap_write_and_wait(mapping); |
1601 | xfs_iunlock(ip, XFS_IOLOCK_SHARED); | ||
1602 | return generic_block_bmap(mapping, block, xfs_get_blocks); | 1599 | return generic_block_bmap(mapping, block, xfs_get_blocks); |
1603 | } | 1600 | } |
1604 | 1601 | ||