aboutsummaryrefslogtreecommitdiffstats
path: root/qgroup-verify.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2016-04-18 10:27:07 +0800
committerDavid Sterba <dsterba@suse.com>2016-05-02 14:42:28 +0200
commitf172bd2b8db3b078f5fb515a772b7e59fea43c8f (patch)
treeed8fc1aff2092760f2b3dfd3b517e03a1cefa3cd /qgroup-verify.c
parentb652aeeb382de8bb1a00888f1a1ec27a2a1056b5 (diff)
downloadbtrfs-progs-f172bd2b8db3b078f5fb515a772b7e59fea43c8f.tar.gz
btrfs-progs-f172bd2b8db3b078f5fb515a772b7e59fea43c8f.tar.xz
btrfs-progs-f172bd2b8db3b078f5fb515a772b7e59fea43c8f.zip
btrfs-progs: Fix return value bug of qgroups check
Before this patch, although btrfsck will check qgroups if quota is enabled, it always return 0 even qgroup numbers are corrupted. Fix it by allowing return value from report_qgroups function (formally defined as print_qgroup_difference). Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'qgroup-verify.c')
-rw-r--r--qgroup-verify.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/qgroup-verify.c b/qgroup-verify.c
index 10ff8e0..c4e9201 100644
--- a/qgroup-verify.c
+++ b/qgroup-verify.c
@@ -1016,7 +1016,7 @@ static void print_fields_signed(long long bytes,
prefix, type, bytes, type, bytes_compressed);
}
-static void print_qgroup_difference(struct qgroup_count *count, int verbose)
+static int report_qgroup_difference(struct qgroup_count *count, int verbose)
{
int is_different;
struct qgroup_info *info = &count->info;
@@ -1046,19 +1046,22 @@ static void print_qgroup_difference(struct qgroup_count *count, int verbose)
print_fields_signed(excl_diff, excl_diff,
"diff:", "exclusive");
}
+ return (is_different && count->subvol_exists);
}
-void print_qgroup_report(int all)
+int report_qgroups(int all)
{
struct rb_node *node;
struct qgroup_count *c;
+ int ret = 0;
node = rb_first(&counts.root);
while (node) {
c = rb_entry(node, struct qgroup_count, rb_node);
- print_qgroup_difference(c, all);
+ ret |= report_qgroup_difference(c, all);
node = rb_next(node);
}
+ return ret;
}
int qgroup_verify_all(struct btrfs_fs_info *info)