Skip to content

Commit af5b5af

Browse files
Christoph Hellwigdjwong
authored andcommitted
xfs: don't start out with the exclusive ilock for direct I/O
There is no reason to take the ilock exclusively at the start of xfs_file_iomap_begin for direct I/O, given that it will be demoted just before calling xfs_iomap_write_direct anyway. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
1 parent 172ed39 commit af5b5af

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/xfs/xfs_iomap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -965,13 +965,11 @@ static inline bool needs_cow_for_zeroing(struct xfs_bmbt_irec *imap, int nimaps)
965965
static inline bool need_excl_ilock(struct xfs_inode *ip, unsigned flags)
966966
{
967967
/*
968-
* COW writes will allocate delalloc space, so we need to make sure
969-
* to take the lock exclusively here.
968+
* COW writes may allocate delalloc space or convert unwritten COW
969+
* extents, so we need to make sure to take the lock exclusively here.
970970
*/
971971
if (xfs_is_reflink_inode(ip) && (flags & (IOMAP_WRITE | IOMAP_ZERO)))
972972
return true;
973-
if ((flags & IOMAP_DIRECT) && (flags & IOMAP_WRITE))
974-
return true;
975973
return false;
976974
}
977975

0 commit comments

Comments
 (0)