summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-04-10 08:28:33 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2018-04-10 08:28:33 -0700
commit4919d42ab69a4e4601f3cd20a9540f3835e0dd48 (patch)
treedd6518a92d3575e8d944fd8b0583a531bae7616d /fs/xfs/xfs_inode.c
parenta1f69417c6f4d1c5280ffb795da7778cba1e1451 (diff)
downloadop-kernel-dev-4919d42ab69a4e4601f3cd20a9540f3835e0dd48.zip
op-kernel-dev-4919d42ab69a4e4601f3cd20a9540f3835e0dd48.tar.gz
xfs: only cancel cow blocks when truncating the data fork
In xfs_itruncate_extents, only cancel cow blocks and clear the reflink flag if we were asked to truncate the data fork. Attr fork blocks cannot be shared, so this makes no sense. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index c09774c..2b70c8b 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1602,13 +1602,15 @@ xfs_itruncate_extents(
goto out;
}
- /* Remove all pending CoW reservations. */
- error = xfs_reflink_cancel_cow_blocks(ip, &tp, first_unmap_block,
- last_block, true);
- if (error)
- goto out;
+ if (whichfork == XFS_DATA_FORK) {
+ /* Remove all pending CoW reservations. */
+ error = xfs_reflink_cancel_cow_blocks(ip, &tp,
+ first_unmap_block, last_block, true);
+ if (error)
+ goto out;
- xfs_itruncate_clear_reflink_flags(ip);
+ xfs_itruncate_clear_reflink_flags(ip);
+ }
/*
* Always re-log the inode so that our permanent transaction can keep
OpenPOWER on IntegriCloud