Commit 4919d42a authored by Darrick J. Wong's avatar Darrick J. Wong

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: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent a1f69417
...@@ -1602,13 +1602,15 @@ xfs_itruncate_extents( ...@@ -1602,13 +1602,15 @@ xfs_itruncate_extents(
goto out; goto out;
} }
/* Remove all pending CoW reservations. */ if (whichfork == XFS_DATA_FORK) {
error = xfs_reflink_cancel_cow_blocks(ip, &tp, first_unmap_block, /* Remove all pending CoW reservations. */
last_block, true); error = xfs_reflink_cancel_cow_blocks(ip, &tp,
if (error) first_unmap_block, last_block, true);
goto out; 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 * Always re-log the inode so that our permanent transaction can keep
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment