Commit 7f9f71be authored by Dave Chinner's avatar Dave Chinner Committed by Darrick J. Wong
Browse files

xfs: extent shifting doesn't fully invalidate page cache



The extent shifting code uses a flush and invalidate mechainsm prior
to shifting extents around. This is similar to what
xfs_free_file_space() does, but it doesn't take into account things
like page cache vs block size differences, and it will fail if there
is a page that it currently busy.

xfs_flush_unmap_range() handles all of these cases, so just convert
xfs_prepare_shift() to us that mechanism rather than having it's own
special sauce.

Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent c0876897
Loading
Loading
Loading
Loading
+1 −7
Original line number Original line Diff line number Diff line
@@ -1195,13 +1195,7 @@ xfs_prepare_shift(
	 * Writeback and invalidate cache for the remainder of the file as we're
	 * Writeback and invalidate cache for the remainder of the file as we're
	 * about to shift down every extent from offset to EOF.
	 * about to shift down every extent from offset to EOF.
	 */
	 */
	error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, offset, -1);
	error = xfs_flush_unmap_range(ip, offset, XFS_ISIZE(ip));
	if (error)
		return error;
	error = invalidate_inode_pages2_range(VFS_I(ip)->i_mapping,
					offset >> PAGE_SHIFT, -1);
	if (error)
		return error;


	/*
	/*
	 * Clean out anything hanging around in the cow fork now that
	 * Clean out anything hanging around in the cow fork now that