xfs: fix pagecache truncation prior to reflink
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 29 Oct 2018 23:46:33 +0000 (10:46 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 29 Oct 2018 23:46:33 +0000 (10:46 +1100)
commit4918ef4ea008cd2ff47eb852894e3f9b9047f4f3
treea043f554c7f08bd035e0352e58f88a9fff979bcb
parent65f098e91ffbb64d7ca2ed93b6ab2428a2e34452
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>
fs/xfs/xfs_reflink.c