aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_reflink.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2016-10-23 23:21:08 -0400
committerDave Chinner <david@fromorbit.com>2016-10-23 23:21:08 -0400
commitc17a8ef43d6b80ed3519b828c37d18645445949f (patch)
tree8f67f36ae789c6ee7888f905b9daf700518fea40 /fs/xfs/xfs_reflink.c
parent7b7381f043568224af798b1decb607dca97b4114 (diff)
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 <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_reflink.c')
-rw-r--r--fs/xfs/xfs_reflink.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index cd308f119e20..a279b4e7f5fe 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -567,10 +567,14 @@ xfs_reflink_cancel_cow_blocks(
567 } 567 }
568 568
569 if (++idx >= ifp->if_bytes / sizeof(struct xfs_bmbt_rec)) 569 if (++idx >= ifp->if_bytes / sizeof(struct xfs_bmbt_rec))
570 return 0; 570 break;
571 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &got); 571 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &got);
572 } 572 }
573 573
574 /* clear tag if cow fork is emptied */
575 if (!ifp->if_bytes)
576 xfs_inode_clear_cowblocks_tag(ip);
577
574 return error; 578 return error;
575} 579}
576 580