Skip to content

Commit f23660f

Browse files
johnpgarryChandan Babu R
authored andcommitted
xfs: Fix xfs_prepare_shift() range for RT
The RT extent range must be considered in the xfs_flush_unmap_range() call to stabilize the boundary. This code change is originally from Dave Chinner. Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: John Garry <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent d3b689d commit f23660f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/xfs/xfs_bmap_util.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ xfs_prepare_shift(
902902
struct xfs_inode *ip,
903903
loff_t offset)
904904
{
905-
struct xfs_mount *mp = ip->i_mount;
905+
unsigned int rounding;
906906
int error;
907907

908908
/*
@@ -920,11 +920,13 @@ xfs_prepare_shift(
920920
* with the full range of the operation. If we don't, a COW writeback
921921
* completion could race with an insert, front merge with the start
922922
* extent (after split) during the shift and corrupt the file. Start
923-
* with the block just prior to the start to stabilize the boundary.
923+
* with the allocation unit just prior to the start to stabilize the
924+
* boundary.
924925
*/
925-
offset = round_down(offset, mp->m_sb.sb_blocksize);
926+
rounding = xfs_inode_alloc_unitsize(ip);
927+
offset = rounddown_64(offset, rounding);
926928
if (offset)
927-
offset -= mp->m_sb.sb_blocksize;
929+
offset -= rounding;
928930

929931
/*
930932
* Writeback and invalidate cache for the remainder of the file as we're

0 commit comments

Comments
 (0)