projects
/
platform
/
upstream
/
btrfs-progs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
btrfs-progs: tests: don't use fallocate in mkfs/014-rootdir-inline-extent
[platform/upstream/btrfs-progs.git]
/
cmds-inspect-tree-stats.c
diff --git
a/cmds-inspect-tree-stats.c
b/cmds-inspect-tree-stats.c
index
58dd29e
..
eced0db
100644
(file)
--- a/
cmds-inspect-tree-stats.c
+++ b/
cmds-inspect-tree-stats.c
@@
-35,7
+35,6
@@
#include "volumes.h"
#include "utils.h"
#include "commands.h"
#include "volumes.h"
#include "utils.h"
#include "commands.h"
-#include "cmds-inspect-tree-stats.h"
#include "help.h"
static int verbose = 0;
#include "help.h"
static int verbose = 0;
@@
-105,7
+104,7
@@
static int walk_leaf(struct btrfs_root *root, struct btrfs_path *path,
struct btrfs_key found_key;
int i;
struct btrfs_key found_key;
int i;
- stat->total_bytes += root->nodesize;
+ stat->total_bytes += root->
fs_info->
nodesize;
stat->total_leaves++;
if (!find_inline)
stat->total_leaves++;
if (!find_inline)
@@
-137,12
+136,13
@@
static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
struct root_stats *stat, int level, int find_inline)
{
struct extent_buffer *b = path->nodes[level];
struct root_stats *stat, int level, int find_inline)
{
struct extent_buffer *b = path->nodes[level];
+ u32 nodesize = root->fs_info->nodesize;
u64 last_block;
u64 last_block;
- u64 cluster_size =
root->
nodesize;
+ u64 cluster_size = nodesize;
int i;
int ret = 0;
int i;
int ret = 0;
- stat->total_bytes +=
root->
nodesize;
+ stat->total_bytes += nodesize;
stat->total_nodes++;
last_block = btrfs_header_bytenr(b);
stat->total_nodes++;
last_block = btrfs_header_bytenr(b);
@@
-152,8
+152,7
@@
static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
path->slots[level] = i;
if ((level - 1) > 0 || find_inline) {
path->slots[level] = i;
if ((level - 1) > 0 || find_inline) {
- tmp = read_tree_block(root, cur_blocknr,
- root->nodesize,
+ tmp = read_tree_block(root->fs_info, cur_blocknr,
btrfs_node_ptr_generation(b, i));
if (!extent_buffer_uptodate(tmp)) {
error("failed to read blocknr %llu",
btrfs_node_ptr_generation(b, i));
if (!extent_buffer_uptodate(tmp)) {
error("failed to read blocknr %llu",
@@
-167,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);
find_inline);
else
ret = walk_leaf(root, path, stat, find_inline);
- if (last_block +
root->
nodesize != cur_blocknr) {
+ if (last_block + nodesize != cur_blocknr) {
u64 distance = calc_distance(last_block +
u64 distance = calc_distance(last_block +
-
root->
nodesize,
+ nodesize,
cur_blocknr);
stat->total_seeks++;
stat->total_seek_len += distance;
cur_blocknr);
stat->total_seeks++;
stat->total_seek_len += distance;
@@
-186,7
+185,7
@@
static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
stat->forward_seeks++;
else
stat->backward_seeks++;
stat->forward_seeks++;
else
stat->backward_seeks++;
- if (cluster_size !=
root->
nodesize) {
+ if (cluster_size != nodesize) {
stat->total_cluster_size += cluster_size;
stat->total_clusters++;
if (cluster_size < stat->min_cluster_size)
stat->total_cluster_size += cluster_size;
stat->total_clusters++;
if (cluster_size < stat->min_cluster_size)
@@
-194,9
+193,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;
}
if (cluster_size > stat->max_cluster_size)
stat->max_cluster_size = cluster_size;
}
- cluster_size =
root->
nodesize;
+ cluster_size = nodesize;
} else {
} else {
- cluster_size +=
root->
nodesize;
+ cluster_size += nodesize;
}
last_block = cur_blocknr;
if (cur_blocknr < stat->lowest_bytenr)
}
last_block = cur_blocknr;
if (cur_blocknr < stat->lowest_bytenr)
@@
-334,10
+333,10
@@
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.lowest_bytenr = btrfs_header_bytenr(root->node);
stat.highest_bytenr = stat.lowest_bytenr;
stat.min_cluster_size = (u64)-1;
- stat.max_cluster_size = root->nodesize;
+ stat.max_cluster_size = root->
fs_info->
nodesize;
path.nodes[level] = root->node;
if (gettimeofday(&start, NULL)) {
path.nodes[level] = root->node;
if (gettimeofday(&start, NULL)) {
- error("cannot get time: %
s", strerror(errno)
);
+ error("cannot get time: %
m"
);
goto out;
}
if (!level) {
goto out;
}
if (!level) {
@@
-351,7
+350,7
@@
static int calc_root_size(struct btrfs_root *tree_root, struct btrfs_key *key,
if (ret)
goto out;
if (gettimeofday(&end, NULL)) {
if (ret)
goto out;
if (gettimeofday(&end, NULL)) {
- error("cannot get time: %
s", strerror(errno)
);
+ error("cannot get time: %
m"
);
goto out;
}
timeval_subtract(&diff, &end, &start);
goto out;
}
timeval_subtract(&diff, &end, &start);