xfs: Fix xfs_flush_unmap_range() range for RT
BugLink: https://bugs.launchpad.net/bugs/2102266 commit d3b689d7c711a9f36d3e48db9eaa75784a892f4c upstream. 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 <hch@lst.de>4 Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: John Garry <john.g.garry@oracle.com> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com> Acked-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Koichiro Den <koichiro.den@canonical.com> Signed-off-by: Mehmet Basaran <mehmet.basaran@canonical.com>
This commit is contained in:
committed by
Mehmet Basaran
parent
92050acff5
commit
445220ea2e
@@ -816,14 +816,18 @@ xfs_flush_unmap_range(
|
||||
xfs_off_t offset,
|
||||
xfs_off_t len)
|
||||
{
|
||||
struct xfs_mount *mp = ip->i_mount;
|
||||
struct inode *inode = VFS_I(ip);
|
||||
xfs_off_t rounding, start, end;
|
||||
int error;
|
||||
|
||||
rounding = max_t(xfs_off_t, mp->m_sb.sb_blocksize, PAGE_SIZE);
|
||||
start = round_down(offset, rounding);
|
||||
end = round_up(offset + len, rounding) - 1;
|
||||
/*
|
||||
* Make sure we extend the flush out to extent alignment
|
||||
* boundaries so any extent range overlapping the start/end
|
||||
* of the modification we are about to do is clean and idle.
|
||||
*/
|
||||
rounding = max_t(xfs_off_t, xfs_inode_alloc_unitsize(ip), PAGE_SIZE);
|
||||
start = rounddown_64(offset, rounding);
|
||||
end = roundup_64(offset + len, rounding) - 1;
|
||||
|
||||
error = filemap_write_and_wait_range(inode->i_mapping, start, end);
|
||||
if (error)
|
||||
|
||||
Reference in New Issue
Block a user