From: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
To: Qu Wenruo <wqu@suse.com>
Cc: <linux-btrfs@vger.kernel.org>, <dsterba@suse.cz>
Subject: Re: [PATCH 3/8] btrfs-progs: qgroup-verify: Move qgroup classification out of report_qgroups
Date: Sat, 4 Nov 2017 22:20:15 +0800 [thread overview]
Message-ID: <20171104142015.GB513@fnst.localdomain> (raw)
In-Reply-To: <20171027072936.4697-4-wqu@suse.com>
On Fri, Oct 27, 2017 at 03:29:31PM +0800, Qu Wenruo wrote:
>The original qgroup-verify integrates qgroup classification into
>report_qgroups().
>This behavior makes silent qgroup repair (or offline rescan) impossible.
>
>To repair qgroup, we must call report_qgroups() to trigger bad qgroup
>classification, which will output error message.
>
>This patch moves bad qgroup classification from report_qgroups() to
>qgroup_verify_all().
>The functionality is not changed, but provides the basis for later
>silent qgroup repair.
>
>Signed-off-by: Qu Wenruo <wqu@suse.com>
>---
> qgroup-verify.c | 28 ++++++++++++++++++++++++++--
> 1 file changed, 26 insertions(+), 2 deletions(-)
>
>diff --git a/qgroup-verify.c b/qgroup-verify.c
>index f509cdb9317a..67bd8b96ddd3 100644
>--- a/qgroup-verify.c
>+++ b/qgroup-verify.c
>@@ -1319,8 +1319,7 @@ void report_qgroups(int all)
> while (node) {
> c = rb_entry(node, struct qgroup_count, rb_node);
>
>- if (report_qgroup_difference(c, all))
>- list_add_tail(&c->bad_list, &bad_qgroups);
>+ report_qgroup_difference(c, all);
>
> node = rb_next(node);
> }
>@@ -1358,9 +1357,20 @@ void free_qgroup_counts(void)
> }
> }
>
>+static bool is_bad_qgroup(struct qgroup_count *count)
>+{
>+ struct qgroup_info *info = &count->info;
>+ struct qgroup_info *disk = &count->diskinfo;
>+ s64 excl_diff = info->exclusive - disk->exclusive;
>+ s64 ref_diff = info->referenced - disk->referenced;
>+
>+ return (excl_diff || ref_diff);
>+}
>+
The function is_bad_qgroup can be reused in report_qgroup_difference.
> int qgroup_verify_all(struct btrfs_fs_info *info)
> {
> int ret;
>+ struct rb_node *node;
>
> if (!info->quota_enabled)
> return 0;
>@@ -1395,6 +1405,20 @@ int qgroup_verify_all(struct btrfs_fs_info *info)
>
> ret = account_all_refs(1, 0);
>
>+ /*
>+ * Do the correctness check here, so for callers who don't want
>+ * verbose report can skip calling report_qgroups()
>+ */
>+ node = rb_first(&counts.root);
>+ while (node) {
>+ struct qgroup_count *c;
>+
>+ c = rb_entry(node, struct qgroup_count, rb_node);
>+ if (is_bad_qgroup(c))
>+ list_add_tail(&c->bad_list, &bad_qgroups);
>+ node = rb_next(node);
>+ }
>+
> out:
> /*
> * Don't free the qgroup count records as they will be walked
>--
>2.14.3
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
--
Thanks,
Lu
next prev parent reply other threads:[~2017-11-04 14:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-27 7:29 [PATCH 0/8] mkfs: Quota support Qu Wenruo
2017-10-27 7:29 ` [PATCH 1/8] btrfs-progs: qgroup-verify: Also repair qgroup status version Qu Wenruo
2017-10-27 7:29 ` [PATCH 2/8] btrfs-progs: qgroup-verify: Use fs_info->readonly to check if we should repair qgroups Qu Wenruo
2017-10-27 7:29 ` [PATCH 3/8] btrfs-progs: qgroup-verify: Move qgroup classification out of report_qgroups Qu Wenruo
2017-11-04 14:20 ` Lu Fengqi [this message]
2017-10-27 7:29 ` [PATCH 4/8] btrfs-progs: qgroup-verify: Allow repair_qgroups function to do silent repair Qu Wenruo
2017-10-27 7:29 ` [PATCH 5/8] btrfs-progs: ctree: Introduce function to create an empty tree Qu Wenruo
2017-11-03 9:12 ` Lu Fengqi
2017-10-27 7:29 ` [PATCH 6/8] btrfs-progs: mkfs: Introduce function to insert qgroup info and limit items Qu Wenruo
2017-10-27 7:29 ` [PATCH 7/8] btrfs-progs: mkfs: Introduce option to enable quota at mkfs time Qu Wenruo
2017-10-27 7:29 ` [PATCH 8/8] btrfs-progs: test/mkfs: Add test case for --enable-quota option Qu Wenruo
2017-10-27 17:37 ` [PATCH 0/8] mkfs: Quota support David Sterba
2017-10-27 23:57 ` Qu Wenruo
2017-11-01 7:18 ` Qu Wenruo
2017-11-04 14:28 ` Lu Fengqi
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=20171104142015.GB513@fnst.localdomain \
--to=lufq.fnst@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.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).