btrfs-progs/debug-tree.c

39 lines
998 B
C
Raw Normal View History

#include <stdio.h>
#include <stdlib.h>
#include "kerncompat.h"
#include "radix-tree.h"
#include "ctree.h"
#include "disk-io.h"
#include "print-tree.h"
2007-03-16 20:20:31 +00:00
#include "transaction.h"
2007-02-28 14:40:58 +00:00
int main(int ac, char **av) {
2007-03-13 14:46:10 +00:00
struct btrfs_super_block super;
struct btrfs_root *root;
2007-03-21 00:35:03 +00:00
if (ac != 2) {
fprintf(stderr, "usage: %s device\n", av[0]);
exit(1);
}
radix_tree_init();
2007-03-21 00:35:03 +00:00
root = open_ctree(av[1], &super);
if (!root) {
fprintf(stderr, "unable to open %s\n", av[1]);
exit(1);
}
printf("fs tree\n");
2007-03-13 14:46:10 +00:00
btrfs_print_tree(root, root->node);
printf("map tree\n");
btrfs_print_tree(root->fs_info->extent_root,
root->fs_info->extent_root->node);
printf("inode tree\n");
btrfs_print_tree(root->fs_info->inode_root,
root->fs_info->inode_root->node);
printf("root tree\n");
btrfs_print_tree(root->fs_info->tree_root,
root->fs_info->tree_root->node);
2007-03-21 00:35:03 +00:00
printf("total blocks %Lu\n", btrfs_super_total_blocks(&super));
printf("blocks used %Lu\n", btrfs_super_blocks_used(&super));
return 0;
}