btrfs-progs: free qgroup counts in btrfsck
authorMark Fasheh <mfasheh@suse.de>
Wed, 15 Jun 2016 22:50:01 +0000 (15:50 -0700)
committerDavid Sterba <dsterba@suse.com>
Fri, 17 Jun 2016 15:16:44 +0000 (17:16 +0200)
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c
qgroup-verify.c
qgroup-verify.h

index ec0bbfd0744c51ec973e8c148a224f3a33d4456b..9927fce644d195261b483d1906482e9f25c8d42d 100644 (file)
@@ -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);
index 86dcd6dfbb066437cc038024fc3afff624581b48..6ca95eb84c4d50ed964da25efcd97412da5ae15b 100644 (file)
@@ -1100,6 +1100,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;
index 37474650c7597b013cbc9978cae5a668925f8ef5..0f8ff9b3477e4de541877fe6173973fb129e786f 100644 (file)
@@ -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