Skip to content

Commit c17a8ef

Browse files
Brian Fosterdchinner
authored andcommitted
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: Brian Foster <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent 7b7381f commit c17a8ef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/xfs/xfs_reflink.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,14 @@ xfs_reflink_cancel_cow_blocks(
567567
}
568568

569569
if (++idx >= ifp->if_bytes / sizeof(struct xfs_bmbt_rec))
570-
return 0;
570+
break;
571571
xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &got);
572572
}
573573

574+
/* clear tag if cow fork is emptied */
575+
if (!ifp->if_bytes)
576+
xfs_inode_clear_cowblocks_tag(ip);
577+
574578
return error;
575579
}
576580

0 commit comments

Comments
 (0)