aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-10-29 19:46:33 -0400
committerDave Chinner <david@fromorbit.com>2018-10-29 19:46:33 -0400
commit4918ef4ea008cd2ff47eb852894e3f9b9047f4f3 (patch)
treea043f554c7f08bd035e0352e58f88a9fff979bcb /fs/xfs/xfs_reflink.c
parent65f098e91ffbb64d7ca2ed93b6ab2428a2e34452 (diff)
xfs: fix pagecache truncation prior to reflink
Prior to remapping blocks, it is necessary to remove pages from the destination file's page cache. Unfortunately, the truncation is not aggressive enough -- if page size > block size, we'll end up zeroing subpage blocks instead of removing them. So, round the start offset down and the end offset up to page boundaries. We already wrote all the dirty data so the larger range shouldn't be a problem. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
-rw-r--r--fs/xfs/xfs_reflink.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 9b1ea42c81d1..e8e86646bb4b 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -1369,8 +1369,9 @@ xfs_reflink_remap_prep(
1369 goto out_unlock; 1369 goto out_unlock;
1370 1370
1371 /* Zap any page cache for the destination file's range. */ 1371 /* Zap any page cache for the destination file's range. */
1372 truncate_inode_pages_range(&inode_out->i_data, pos_out, 1372 truncate_inode_pages_range(&inode_out->i_data,
1373 PAGE_ALIGN(pos_out + *len) - 1); 1373 round_down(pos_out, PAGE_SIZE),
1374 round_up(pos_out + *len, PAGE_SIZE) - 1);
1374 1375
1375 return 1; 1376 return 1;
1376out_unlock: 1377out_unlock: