linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Fasheh <mfasheh@suse.de>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.cz>,
	Qu Wenruo <quwenruo@cn.fujitsu.com>,
	Mark Fasheh <mfasheh@suse.de>
Subject: [PATCH 1/2] btrfs-progs: free qgroup counts in btrfsck
Date: Wed, 15 Jun 2016 15:50:01 -0700	[thread overview]
Message-ID: <1466031002-14533-2-git-send-email-mfasheh@suse.de> (raw)
In-Reply-To: <1466031002-14533-1-git-send-email-mfasheh@suse.de>

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
---
 cmds-check.c    |  1 +
 qgroup-verify.c | 13 +++++++++++++
 qgroup-verify.h |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/cmds-check.c b/cmds-check.c
index bada87e..7b65f89 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -9890,6 +9890,7 @@ out:
 		(unsigned long long)data_bytes_allocated,
 		(unsigned long long)data_bytes_referenced);
 
+	free_qgroup_counts();
 	free_root_recs_tree(&root_cache);
 close_out:
 	close_ctree(root);
diff --git a/qgroup-verify.c b/qgroup-verify.c
index 1a0d38c..7b78504 100644
--- a/qgroup-verify.c
+++ b/qgroup-verify.c
@@ -1095,6 +1095,19 @@ int report_qgroups(int all)
 	return ret;
 }
 
+void free_qgroup_counts(void)
+{
+	struct rb_node *node;
+	struct qgroup_count *c;
+	node = rb_first(&counts.root);
+	while (node) {
+		c = rb_entry(node, struct qgroup_count, rb_node);
+		node = rb_next(node);
+		rb_erase(&c->rb_node, &counts.root);
+		free(c);
+	}
+}
+
 int qgroup_verify_all(struct btrfs_fs_info *info)
 {
 	int ret;
diff --git a/qgroup-verify.h b/qgroup-verify.h
index 3747465..0f8ff9b 100644
--- a/qgroup-verify.h
+++ b/qgroup-verify.h
@@ -27,4 +27,6 @@ int report_qgroups(int all);
 
 int print_extent_state(struct btrfs_fs_info *info, u64 subvol);
 
+void free_qgroup_counts(void);
+
 #endif
-- 
2.1.4


  reply	other threads:[~2016-06-15 22:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 22:50 [PATCH 0/2] btrfs-progs: qgroup verification update Mark Fasheh
2016-06-15 22:50 ` Mark Fasheh [this message]
2016-06-17 15:34   ` [PATCH 1/2] btrfs-progs: free qgroup counts in btrfsck David Sterba
2016-06-15 22:50 ` [PATCH 2/2] btrfs-progs: btrfsck: verify qgroups above level 0 Mark Fasheh
2016-06-17 15:34   ` 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=1466031002-14533-2-git-send-email-mfasheh@suse.de \
    --to=mfasheh@suse.de \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo@cn.fujitsu.com \
    /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).