xfs: only flush the unshared range in xfs_reflink_unshare
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 3 Nov 2020 01:14:07 +0000 (17:14 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Thu, 5 Nov 2020 01:41:56 +0000 (17:41 -0800)
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>
fs/xfs/xfs_reflink.c

index 16098dc42addb81cd3f862113d719edf8a3e73b3..6fa05fb78189bb1b2479d5071f690ed00e22f8d2 100644 (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;