btrfs-progs: check: introduce function to check referencer for data backref
[platform/upstream/btrfs-progs.git] / cmds-inspect-tree-stats.c
index 792ccaa..c35f588 100644 (file)
@@ -104,7 +104,7 @@ static int walk_leaf(struct btrfs_root *root, struct btrfs_path *path,
        struct btrfs_key found_key;
        int i;
 
-       stat->total_bytes += root->leafsize;
+       stat->total_bytes += root->nodesize;
        stat->total_leaves++;
 
        if (!find_inline)
@@ -137,7 +137,7 @@ static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
 {
        struct extent_buffer *b = path->nodes[level];
        u64 last_block;
-       u64 cluster_size = root->leafsize;
+       u64 cluster_size = root->nodesize;
        int i;
        int ret = 0;
 
@@ -152,7 +152,7 @@ static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
                path->slots[level] = i;
                if ((level - 1) > 0 || find_inline) {
                        tmp = read_tree_block(root, cur_blocknr,
-                                             btrfs_level_size(root, level - 1),
+                                             root->nodesize,
                                              btrfs_node_ptr_generation(b, i));
                        if (!extent_buffer_uptodate(tmp)) {
                                fprintf(stderr, "Failed to read blocknr %llu\n",
@@ -166,9 +166,9 @@ static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
                                         find_inline);
                else
                        ret = walk_leaf(root, path, stat, find_inline);
-               if (last_block + root->leafsize != cur_blocknr) {
+               if (last_block + root->nodesize != cur_blocknr) {
                        u64 distance = calc_distance(last_block +
-                                                    root->leafsize,
+                                                    root->nodesize,
                                                     cur_blocknr);
                        stat->total_seeks++;
                        stat->total_seek_len += distance;
@@ -184,7 +184,7 @@ static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
                                stat->forward_seeks++;
                        else
                                stat->backward_seeks++;
-                       if (cluster_size != root->leafsize) {
+                       if (cluster_size != root->nodesize) {
                                stat->total_cluster_size += cluster_size;
                                stat->total_clusters++;
                                if (cluster_size < stat->min_cluster_size)
@@ -192,9 +192,9 @@ static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
                                if (cluster_size > stat->max_cluster_size)
                                        stat->max_cluster_size = cluster_size;
                        }
-                       cluster_size = root->leafsize;
+                       cluster_size = root->nodesize;
                } else {
-                       cluster_size += root->leafsize;
+                       cluster_size += root->nodesize;
                }
                last_block = cur_blocknr;
                if (cur_blocknr < stat->lowest_bytenr)
@@ -337,7 +337,7 @@ static int calc_root_size(struct btrfs_root *tree_root, struct btrfs_key *key,
        stat.lowest_bytenr = btrfs_header_bytenr(root->node);
        stat.highest_bytenr = stat.lowest_bytenr;
        stat.min_cluster_size = (u64)-1;
-       stat.max_cluster_size = root->leafsize;
+       stat.max_cluster_size = root->nodesize;
        path->nodes[level] = root->node;
        if (gettimeofday(&start, NULL)) {
                fprintf(stderr, "Error getting time: %d\n", errno);
@@ -496,7 +496,7 @@ int cmd_inspect_tree_stats(int argc, char **argv)
 
        key.objectid = BTRFS_FS_TREE_OBJECTID;
        key.offset = (u64)-1;
-       printf("Calculatin' size of fs tree\n");
+       printf("Calculating size of fs tree\n");
        ret = calc_root_size(root, &key, 1);
        if (ret)
                goto out;