aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-10-18 02:19:58 -0400
committerDave Chinner <david@fromorbit.com>2018-10-18 02:19:58 -0400
commit032dc923b2baef87db6c812f6e8bebcb7638cab8 (patch)
treec85c9b5e888b0a6d0e63dd661373e96ae0caf067 /fs/xfs/xfs_reflink.c
parentd392bc81bb7c26ea6225d088ead344ed6486b495 (diff)
xfs: fix fork selection in xfs_find_trim_cow_extent
We should want to write directly into the data fork for blocks that don't have an extent in the COW fork covering them yet. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
-rw-r--r--fs/xfs/xfs_reflink.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 80e5e79b86b0..8eaeec9d58ed 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -369,9 +369,13 @@ xfs_find_trim_cow_extent(
369 * If we don't find an overlapping extent, trim the range we need to 369 * If we don't find an overlapping extent, trim the range we need to
370 * allocate to fit the hole we found. 370 * allocate to fit the hole we found.
371 */ 371 */
372 if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got) || 372 if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got))
373 got.br_startoff > offset_fsb) 373 got.br_startoff = offset_fsb + count_fsb;
374 if (got.br_startoff > offset_fsb) {
375 xfs_trim_extent(imap, imap->br_startoff,
376 got.br_startoff - imap->br_startoff);
374 return xfs_reflink_trim_around_shared(ip, imap, shared); 377 return xfs_reflink_trim_around_shared(ip, imap, shared);
378 }
375 379
376 *shared = true; 380 *shared = true;
377 if (isnullstartblock(got.br_startblock)) { 381 if (isnullstartblock(got.br_startblock)) {