mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 19:49:33 -04:00
xfs: cleanup xfs_ilock_iocb_for_write
Move the relock path out of the straight line and add a comment explaining why it exists. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
This commit is contained in:
committed by
Chandan Babu R
parent
8626b67acf
commit
29bc0dd0a2
@@ -213,14 +213,18 @@ xfs_ilock_iocb_for_write(
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (*lock_mode == XFS_IOLOCK_EXCL)
|
||||
return 0;
|
||||
if (!xfs_iflags_test(ip, XFS_IREMAPPING))
|
||||
return 0;
|
||||
/*
|
||||
* If a reflink remap is in progress we always need to take the iolock
|
||||
* exclusively to wait for it to finish.
|
||||
*/
|
||||
if (*lock_mode == XFS_IOLOCK_SHARED &&
|
||||
xfs_iflags_test(ip, XFS_IREMAPPING)) {
|
||||
xfs_iunlock(ip, *lock_mode);
|
||||
*lock_mode = XFS_IOLOCK_EXCL;
|
||||
return xfs_ilock_iocb(iocb, *lock_mode);
|
||||
}
|
||||
|
||||
xfs_iunlock(ip, *lock_mode);
|
||||
*lock_mode = XFS_IOLOCK_EXCL;
|
||||
return xfs_ilock_iocb(iocb, *lock_mode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
|
||||
Reference in New Issue
Block a user