All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs-progs: qgroup: Fix a bug that fails to skip rescan running case
Date: Thu, 16 Jun 2016 09:15:51 +0800	[thread overview]
Message-ID: <20160616011551.4356-1-quwenruo@cn.fujitsu.com> (raw)

Commit 6bdf962fe35a8648d(btrfs-progs: Read qgroup status for qgroup
verify) will read qgroup status, and then use it to skip qgroup
reporting.

However since the rescan_running/inconsistent flags are only 1 bit long,
while qgroup flags & BTRFS_QGROUP_FLAGS returns value longer than 1bit,
it doesn't work.

Fix it by doing double negation on (flags & BTRFS_QGROUP_FLAGS) to
convert it to either 1 or 0.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 qgroup-verify.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/qgroup-verify.c b/qgroup-verify.c
index 1a0d38c..86dcd6d 100644
--- a/qgroup-verify.c
+++ b/qgroup-verify.c
@@ -711,8 +711,13 @@ static void read_qgroup_status(struct btrfs_path *path,
 	status_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
 				     struct btrfs_qgroup_status_item);
 	flags = btrfs_qgroup_status_flags(path->nodes[0], status_item);
-	counts->qgroup_inconsist = flags & BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT;
-	counts->rescan_running = flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN;
+	/*
+	 * Since qgroup_inconsist/rescan_running is just one bit,
+	 * assign value directly won't work.
+	 */
+	counts->qgroup_inconsist = !!(flags &
+			BTRFS_QGROUP_STATUS_FLAG_INCONSISTENT);
+	counts->rescan_running = !!(flags & BTRFS_QGROUP_STATUS_FLAG_RESCAN);
 }
 
 static int load_quota_info(struct btrfs_fs_info *info)
-- 
2.8.3




             reply	other threads:[~2016-06-16  1:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16  1:15 Qu Wenruo [this message]
2016-06-17 15:07 ` [PATCH] btrfs-progs: qgroup: Fix a bug that fails to skip rescan running case 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=20160616011551.4356-1-quwenruo@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.