mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 14:45:19 +00:00
btrfs-progs: tree-stats: switch to common message helpers
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
4a16608150
commit
acf978a2d4
@ -155,7 +155,7 @@ static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
|
|||||||
root->nodesize,
|
root->nodesize,
|
||||||
btrfs_node_ptr_generation(b, i));
|
btrfs_node_ptr_generation(b, i));
|
||||||
if (!extent_buffer_uptodate(tmp)) {
|
if (!extent_buffer_uptodate(tmp)) {
|
||||||
fprintf(stderr, "Failed to read blocknr %llu\n",
|
error("failed to read blocknr %llu",
|
||||||
btrfs_node_blockptr(b, i));
|
btrfs_node_blockptr(b, i));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -175,7 +175,8 @@ static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
|
|||||||
if (stat->max_seek_len < distance)
|
if (stat->max_seek_len < distance)
|
||||||
stat->max_seek_len = distance;
|
stat->max_seek_len = distance;
|
||||||
if (add_seek(&stat->seek_root, distance)) {
|
if (add_seek(&stat->seek_root, distance)) {
|
||||||
fprintf(stderr, "Error adding new seek\n");
|
error("cannot add new seek at distance %llu",
|
||||||
|
(unsigned long long)distance);
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -203,7 +204,7 @@ static int walk_nodes(struct btrfs_root *root, struct btrfs_path *path,
|
|||||||
stat->highest_bytenr = cur_blocknr;
|
stat->highest_bytenr = cur_blocknr;
|
||||||
free_extent_buffer(tmp);
|
free_extent_buffer(tmp);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
fprintf(stderr, "Error walking down path\n");
|
error("walking down path failed: %d", ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,13 +323,13 @@ static int calc_root_size(struct btrfs_root *tree_root, struct btrfs_key *key,
|
|||||||
|
|
||||||
root = btrfs_read_fs_root(tree_root->fs_info, key);
|
root = btrfs_read_fs_root(tree_root->fs_info, key);
|
||||||
if (IS_ERR(root)) {
|
if (IS_ERR(root)) {
|
||||||
fprintf(stderr, "Failed to read root %llu\n", key->objectid);
|
error("failed to read root %llu", key->objectid);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
if (!path) {
|
if (!path) {
|
||||||
fprintf(stderr, "Could not allocate path\n");
|
error("could not allocate path");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,7 +341,7 @@ static int calc_root_size(struct btrfs_root *tree_root, struct btrfs_key *key,
|
|||||||
stat.max_cluster_size = root->nodesize;
|
stat.max_cluster_size = root->nodesize;
|
||||||
path->nodes[level] = root->node;
|
path->nodes[level] = root->node;
|
||||||
if (gettimeofday(&start, NULL)) {
|
if (gettimeofday(&start, NULL)) {
|
||||||
fprintf(stderr, "Error getting time: %d\n", errno);
|
error("cannot get time: %s", strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (!level) {
|
if (!level) {
|
||||||
@ -354,7 +355,7 @@ static int calc_root_size(struct btrfs_root *tree_root, struct btrfs_key *key,
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
if (gettimeofday(&end, NULL)) {
|
if (gettimeofday(&end, NULL)) {
|
||||||
fprintf(stderr, "Error getting time: %d\n", errno);
|
error("cannot get time: %s", strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
timeval_subtract(&diff, &end, &start);
|
timeval_subtract(&diff, &end, &start);
|
||||||
@ -468,7 +469,7 @@ int cmd_inspect_tree_stats(int argc, char **argv)
|
|||||||
|
|
||||||
root = open_ctree(argv[optind], 0, 0);
|
root = open_ctree(argv[optind], 0, 0);
|
||||||
if (!root) {
|
if (!root) {
|
||||||
fprintf(stderr, "Couldn't open ctree\n");
|
error("cannot open ctree");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user