static void add_bytes(u64 root_objectid, u64 num_bytes, int exclusive);
+struct qgroup_info {
+ u64 referenced;
+ u64 referenced_compressed;
+ u64 exclusive;
+ u64 exclusive_compressed;
+};
+
struct qgroup_count {
- u64 qgroupid;
- int subvol_exists;
+ u64 qgroupid;
+ int subvol_exists;
- struct btrfs_disk_key key;
- struct btrfs_qgroup_info_item diskinfo;
+ struct btrfs_disk_key key;
+ struct qgroup_info diskinfo;
- struct btrfs_qgroup_info_item info;
+ struct qgroup_info info;
- struct rb_node rb_node;
+ struct rb_node rb_node;
};
-struct counts_tree {
+static struct counts_tree {
struct rb_root root;
unsigned int num_groups;
} counts = { .root = RB_ROOT };
-struct rb_root by_bytenr = RB_ROOT;
+static struct rb_root by_bytenr = RB_ROOT;
/*
* List of interior tree blocks. We walk this list after loading the
* exist further down the tree, the fact that our interior node has a
* ref means we need to account anything below it to all its roots.
*/
-struct ulist *tree_blocks = NULL; /* unode->val = bytenr, ->aux
- * = tree_block pointer */
+static struct ulist *tree_blocks = NULL; /* unode->val = bytenr, ->aux
+ * = tree_block pointer */
struct tree_block {
int level;
u64 num_bytes;
// bytenr, num_bytes, ref_parent);
eb = read_tree_block(root, bytenr, num_bytes, 0);
- if (!eb)
+ if (!extent_buffer_uptodate(eb))
return -EIO;
ret = 0;
struct tree_block *block)
{
int ret;
- u64 root_bytenr = resolve_one_root(bytenr);
+ u64 root_id = resolve_one_root(bytenr);
struct btrfs_root *root;
struct btrfs_key key;
- key.objectid = root_bytenr;
+ key.objectid = root_id;
key.type = BTRFS_ROOT_ITEM_KEY;
key.offset = (u64)-1;
struct btrfs_qgroup_info_item *disk)
{
struct qgroup_count *c = calloc(1, sizeof(*c));
- struct btrfs_qgroup_info_item *item;
+ struct qgroup_info *item;
if (c) {
c->qgroupid = btrfs_disk_key_offset(key);
c->key = *key;
item = &c->diskinfo;
- item->generation = btrfs_qgroup_info_generation(leaf, disk);
item->referenced = btrfs_qgroup_info_referenced(leaf, disk);
item->referenced_compressed =
btrfs_qgroup_info_referenced_compressed(leaf, disk);
static void add_bytes(u64 root_objectid, u64 num_bytes, int exclusive)
{
struct qgroup_count *count = find_count(root_objectid);
- struct btrfs_qgroup_info_item *qg;
+ struct qgroup_info *qg;
BUG_ON(num_bytes < 4096); /* Random sanity check. */
static void print_qgroup_difference(struct qgroup_count *count, int verbose)
{
int is_different;
- struct btrfs_qgroup_info_item *info = &count->info;
- struct btrfs_qgroup_info_item *disk = &count->diskinfo;
+ struct qgroup_info *info = &count->info;
+ struct qgroup_info *disk = &count->diskinfo;
long long excl_diff = info->exclusive - disk->exclusive;
long long ref_diff = info->referenced - disk->referenced;