From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH v3 5/7] btrfs: qgroup: Don't trace subtree if we're dropping reloc tree
Date: Tue, 11 Sep 2018 13:38:16 +0800	[thread overview]
Message-ID: <20180911053818.10191-6-wqu@suse.com> (raw)
In-Reply-To: <20180911053818.10191-1-wqu@suse.com>
Reloc tree doesn't contribute to qgroup numbers, as we have
accounted them at balance time (check replace_path()).
Skip such unneeded subtree trace should reduce some performance
overhead.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/extent-tree.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index de6f75f5547b..4588153f414c 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -8643,7 +8643,13 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
 			parent = 0;
 		}
 
-		if (need_account) {
+		/*
+		 * Tree reloc tree doesn't contribute to qgroup numbers, and
+		 * we have already accounted them at merge time (replace_path),
+		 * thus we could skip expensive subtree trace here.
+		 */
+		if (root->root_key.objectid != BTRFS_TREE_RELOC_OBJECTID &&
+		    need_account) {
 			ret = btrfs_qgroup_trace_subtree(trans, next,
 							 generation, level - 1);
 			if (ret) {
-- 
2.18.0
next prev parent reply	other threads:[~2018-09-11 10:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11  5:38 [PATCH v3 0/7] btrfs: qgroup: Reduce dirty extents for metadata Qu Wenruo
2018-09-11  5:38 ` [PATCH v3 1/7] btrfs: qgroup: Introduce trace event to analyse the number of dirty extents accounted Qu Wenruo
2018-09-26 14:06   ` David Sterba
2018-09-11  5:38 ` [PATCH v3 2/7] btrfs: qgroup: Introduce function to trace two swaped extents Qu Wenruo
2018-09-11  5:38 ` [PATCH v3 3/7] btrfs: qgroup: Introduce function to find all new tree blocks of reloc tree Qu Wenruo
2018-09-26 14:29   ` David Sterba
2018-09-26 14:40     ` Qu Wenruo
2018-09-11  5:38 ` [PATCH v3 4/7] btrfs: qgroup: Use generation aware subtree swap to mark dirty extents Qu Wenruo
2018-09-26 14:35   ` David Sterba
2018-09-26 14:43     ` Qu Wenruo
2018-09-11  5:38 ` Qu Wenruo [this message]
2018-09-26 14:35   ` [PATCH v3 5/7] btrfs: qgroup: Don't trace subtree if we're dropping reloc tree David Sterba
2018-09-11  5:38 ` [PATCH v3 6/7] btrfs: delayed-ref: Introduce new parameter for btrfs_add_delayed_tree_ref() to reduce unnecessary qgroup tracing Qu Wenruo
2018-09-26 14:40   ` David Sterba
2018-09-27  5:31     ` Qu Wenruo
2018-09-11  5:38 ` [PATCH v3 7/7] btrfs: qgroup: Only trace data extents in leaves if we're relocating data block group Qu Wenruo
2018-09-26 14:06 ` [PATCH v3 0/7] btrfs: qgroup: Reduce dirty extents for metadata David Sterba
2018-09-26 14:17   ` Qu Wenruo
2018-09-26 14:25     ` Qu Wenruo
2018-09-26 14:26     ` David Sterba
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=20180911053818.10191-6-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@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).