diff options
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_util.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_reflink.c | 17 |
3 files changed, 17 insertions, 5 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 167ff4297e5c..404e581f1ea1 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c | |||
@@ -1042,7 +1042,7 @@ out_trans_cancel: | |||
1042 | goto out_unlock; | 1042 | goto out_unlock; |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | static int | 1045 | int |
1046 | xfs_flush_unmap_range( | 1046 | xfs_flush_unmap_range( |
1047 | struct xfs_inode *ip, | 1047 | struct xfs_inode *ip, |
1048 | xfs_off_t offset, | 1048 | xfs_off_t offset, |
diff --git a/fs/xfs/xfs_bmap_util.h b/fs/xfs/xfs_bmap_util.h index 87363d136bb6..7a78229cf1a7 100644 --- a/fs/xfs/xfs_bmap_util.h +++ b/fs/xfs/xfs_bmap_util.h | |||
@@ -80,4 +80,7 @@ int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip, | |||
80 | int whichfork, xfs_extnum_t *nextents, | 80 | int whichfork, xfs_extnum_t *nextents, |
81 | xfs_filblks_t *count); | 81 | xfs_filblks_t *count); |
82 | 82 | ||
83 | int xfs_flush_unmap_range(struct xfs_inode *ip, xfs_off_t offset, | ||
84 | xfs_off_t len); | ||
85 | |||
83 | #endif /* __XFS_BMAP_UTIL_H__ */ | 86 | #endif /* __XFS_BMAP_UTIL_H__ */ |
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index c56bdbfcf7ae..322a852ce284 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c | |||
@@ -1352,10 +1352,19 @@ xfs_reflink_remap_prep( | |||
1352 | if (ret) | 1352 | if (ret) |
1353 | goto out_unlock; | 1353 | goto out_unlock; |
1354 | 1354 | ||
1355 | /* Zap any page cache for the destination file's range. */ | 1355 | /* |
1356 | truncate_inode_pages_range(&inode_out->i_data, | 1356 | * If pos_out > EOF, we may have dirtied blocks between EOF and |
1357 | round_down(pos_out, PAGE_SIZE), | 1357 | * pos_out. In that case, we need to extend the flush and unmap to cover |
1358 | round_up(pos_out + *len, PAGE_SIZE) - 1); | 1358 | * from EOF to the end of the copy length. |
1359 | */ | ||
1360 | if (pos_out > XFS_ISIZE(dest)) { | ||
1361 | loff_t flen = *len + (pos_out - XFS_ISIZE(dest)); | ||
1362 | ret = xfs_flush_unmap_range(dest, XFS_ISIZE(dest), flen); | ||
1363 | } else { | ||
1364 | ret = xfs_flush_unmap_range(dest, pos_out, *len); | ||
1365 | } | ||
1366 | if (ret) | ||
1367 | goto out_unlock; | ||
1359 | 1368 | ||
1360 | return 1; | 1369 | return 1; |
1361 | out_unlock: | 1370 | out_unlock: |