From: Brian Foster <bfoster@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 2/3] xfs: clear cowblocks tag when cow fork is emptied
Date: Fri, 21 Oct 2016 13:22:12 -0400 [thread overview]
Message-ID: <1477070533-59327-3-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1477070533-59327-1-git-send-email-bfoster@redhat.com>
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>
---
fs/xfs/xfs_reflink.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index cd308f1..a279b4e 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -567,10 +567,14 @@ xfs_reflink_cancel_cow_blocks(
}
if (++idx >= ifp->if_bytes / sizeof(struct xfs_bmbt_rec))
- return 0;
+ break;
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;
}
--
2.7.4
next prev parent reply other threads:[~2016-10-21 17:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-21 17:22 [PATCH 0/3] xfs: a few reflink cowblocks fixes Brian Foster
2016-10-21 17:22 ` [PATCH 1/3] xfs: fix up inode cowblocks tracking tracepoints Brian Foster
2016-10-22 0:52 ` Darrick J. Wong
2016-10-22 8:46 ` Christoph Hellwig
2016-10-21 17:22 ` Brian Foster [this message]
2016-10-22 0:58 ` [PATCH 2/3] xfs: clear cowblocks tag when cow fork is emptied Darrick J. Wong
2016-10-22 8:47 ` Christoph Hellwig
2016-10-21 17:22 ` [PATCH 3/3] xfs: don't skip cow forks w/ delalloc blocks in cowblocks scan Brian Foster
2016-10-22 8:49 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1477070533-59327-3-git-send-email-bfoster@redhat.com \
--to=bfoster@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).