Commit c17a8ef4 authored by Brian Foster's avatar Brian Foster Committed by Dave Chinner

xfs: clear cowblocks tag when cow fork is emptied

The background cowblocks scan job takes care of scanning for inodes with
potentially lingering blocks in the cow fork and clearing them out. If
the background scanner reclaims the cow fork blocks, however, it doesn't
immediately clear the cowblocks tag from the inode. Instead, the inode
remains tagged until the background scanner comes around again,
discovers the inode cow fork has no blocks, clears the tag and fires the
trace_xfs_inode_free_cowblocks_invalid() tracepoint to indicate that the
inode may have been incorrectly tagged.

This is not a major functional problem as the tag is ultimately cleared.
Nonetheless, clear the tag when an inode cow fork is explicitly emptied
to avoid the extra round trip through the background scanner and
spurious "invalid" tracepoint.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 7b7381f0
...@@ -567,10 +567,14 @@ xfs_reflink_cancel_cow_blocks( ...@@ -567,10 +567,14 @@ xfs_reflink_cancel_cow_blocks(
} }
if (++idx >= ifp->if_bytes / sizeof(struct xfs_bmbt_rec)) if (++idx >= ifp->if_bytes / sizeof(struct xfs_bmbt_rec))
return 0; break;
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &got); xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &got);
} }
/* clear tag if cow fork is emptied */
if (!ifp->if_bytes)
xfs_inode_clear_cowblocks_tag(ip);
return error; return error;
} }
......
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