xfs: only flush the unshared range in xfs_reflink_unshare

There's no reason to flush an entire file when we're unsharing part of
a file.  Therefore, only initiate writeback on the selected range.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
This commit is contained in:
Darrick J. Wong 2020-11-02 17:14:07 -08:00
parent c1f6b1ac00
commit 46afb0628b

View File

@ -1502,7 +1502,8 @@ xfs_reflink_unshare(
&xfs_buffered_write_iomap_ops);
if (error)
goto out;
error = filemap_write_and_wait(inode->i_mapping);
error = filemap_write_and_wait_range(inode->i_mapping, offset, len);
if (error)
goto out;