@@ -885,7 +885,7 @@ xfs_writepage_map(
continue;
}
- if (xfs_is_reflink_inode(XFS_I(inode))) {
+ if (XFS_I(inode)->i_cowfp) {
error = xfs_map_cow(wpc, inode, offset, &new_type);
if (error)
goto out;
@@ -1574,7 +1574,7 @@ xfs_inode_free_cowblocks(
* Just clear the tag if we have an empty cow fork or none at all. It's
* possible the inode was fully unshared since it was originally tagged.
*/
- if (!xfs_is_reflink_inode(ip) || !ifp->if_bytes) {
+ if (!ifp || !ifp->if_bytes) {
trace_xfs_inode_free_cowblocks_invalid(ip);
xfs_inode_clear_cowblocks_tag(ip);
return 0;
@@ -496,7 +496,6 @@ xfs_reflink_find_cow_mapping(
xfs_extnum_t idx;
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL | XFS_ILOCK_SHARED));
- ASSERT(xfs_is_reflink_inode(ip));
offset_fsb = XFS_B_TO_FSBT(ip->i_mount, offset);
if (!xfs_iext_lookup_extent(ip, ifp, offset_fsb, &idx, &got))
@@ -523,7 +522,7 @@ xfs_reflink_trim_irec_to_next_cow(
struct xfs_bmbt_irec got;
xfs_extnum_t idx;
- if (!xfs_is_reflink_inode(ip))
+ if (!ifp)
return;
/* Find the extent in the CoW fork. */
@@ -561,7 +560,7 @@ xfs_reflink_cancel_cow_blocks(
struct xfs_defer_ops dfops;
int error = 0;
- if (!xfs_is_reflink_inode(ip))
+ if (!ifp)
return 0;
if (!xfs_iext_lookup_extent(ip, ifp, offset_fsb, &idx, &got))
return 0;
@@ -634,7 +633,7 @@ xfs_reflink_cancel_cow_range(
int error;
trace_xfs_reflink_cancel_cow_range(ip, offset, count);
- ASSERT(xfs_is_reflink_inode(ip));
+ ASSERT(ip->i_cowfp);
offset_fsb = XFS_B_TO_FSBT(ip->i_mount, offset);
if (count == NULLFILEOFF)
@@ -952,7 +952,7 @@ xfs_fs_destroy_inode(
XFS_STATS_INC(ip->i_mount, vn_rele);
XFS_STATS_INC(ip->i_mount, vn_remove);
- if (xfs_is_reflink_inode(ip)) {
+ if (ip->i_cowfp) {
error = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, 0);
if (error && !XFS_FORCED_SHUTDOWN(ip->i_mount))
xfs_warn(ip->i_mount,
We'll soon need to distinguish between inodes that actually are reflinked, and those that just use the COW fork for atomic write operations. Switch a few places to check for the existance of a COW for instead of the reflink to prepare for that. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_icache.c | 2 +- fs/xfs/xfs_reflink.c | 7 +++---- fs/xfs/xfs_super.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-)