Skip to content

Commit d3b689d

Browse files
johnpgarryChandan Babu R
authored andcommitted
xfs: Fix xfs_flush_unmap_range() range for RT
Currently xfs_flush_unmap_range() does unmap for a full RT extent range, which we also want to ensure is clean and idle. This code change is originally from Dave Chinner. Reviewed-by: Christoph Hellwig <[email protected]>4 Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: John Garry <[email protected]> Signed-off-by: Chandan Babu R <[email protected]>
1 parent d40c286 commit d3b689d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

fs/xfs/xfs_bmap_util.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -808,14 +808,18 @@ xfs_flush_unmap_range(
808808
xfs_off_t offset,
809809
xfs_off_t len)
810810
{
811-
struct xfs_mount *mp = ip->i_mount;
812811
struct inode *inode = VFS_I(ip);
813812
xfs_off_t rounding, start, end;
814813
int error;
815814

816-
rounding = max_t(xfs_off_t, mp->m_sb.sb_blocksize, PAGE_SIZE);
817-
start = round_down(offset, rounding);
818-
end = round_up(offset + len, rounding) - 1;
815+
/*
816+
* Make sure we extend the flush out to extent alignment
817+
* boundaries so any extent range overlapping the start/end
818+
* of the modification we are about to do is clean and idle.
819+
*/
820+
rounding = max_t(xfs_off_t, xfs_inode_alloc_unitsize(ip), PAGE_SIZE);
821+
start = rounddown_64(offset, rounding);
822+
end = roundup_64(offset + len, rounding) - 1;
819823

820824
error = filemap_write_and_wait_range(inode->i_mapping, start, end);
821825
if (error)

0 commit comments

Comments
 (0)