summaryrefslogtreecommitdiff
path: root/cmds-check.c
diff options
context:
space:
mode:
authorGu Jinxiang <gujx@cn.fujitsu.com>2018-01-26 15:26:01 +0800
committerDavid Sterba <dsterba@suse.com>2018-02-02 16:01:57 +0100
commit3809b36d855fd13aad31c3a426a4d7434180003a (patch)
tree842de957ad985ea5a19e4c53e80df6bd5d150f95 /cmds-check.c
parent26072f584d347ef2d471c02fbe27dbfedd606ac4 (diff)
btrfs-progs: Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK
Do a cleanup. Also make it consistent with kernel. Use fs_info instead of root for BTRFS_NODEPTRS_PER_BLOCK, since maybe in some situation we do not know root, but just know fs_info. To be consistent with kernel, change macro to inline function. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-check.c')
-rw-r--r--cmds-check.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmds-check.c b/cmds-check.c
index 02371a0a..cb34f27a 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -2518,7 +2518,7 @@ static void account_bytes(struct btrfs_root *root, struct btrfs_path *path,
if (level == 0) {
btree_space_waste += btrfs_leaf_free_space(root, eb);
} else {
- free_nrs = (BTRFS_NODEPTRS_PER_BLOCK(root) -
+ free_nrs = (BTRFS_NODEPTRS_PER_BLOCK(root->fs_info) -
btrfs_header_nritems(eb));
btree_space_waste += free_nrs * sizeof(struct btrfs_key_ptr);
}
@@ -9480,7 +9480,7 @@ static int run_next_block(struct btrfs_root *root,
add_pending(pending, seen, ptr, size);
}
}
- btree_space_waste += (BTRFS_NODEPTRS_PER_BLOCK(root) -
+ btree_space_waste += (BTRFS_NODEPTRS_PER_BLOCK(fs_info) -
nritems) * sizeof(struct btrfs_key_ptr);
}
total_btree_bytes += buf->len;