generations on headers
[btrfs-progs-unstable.git] / debug-tree.c
blobfd07969600c67da363e91212041ec847e56992eb
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include "kerncompat.h"
4 #include "radix-tree.h"
5 #include "ctree.h"
6 #include "disk-io.h"
7 #include "print-tree.h"
8 #include "transaction.h"
10 int main(int ac, char **av) {
11 struct btrfs_super_block super;
12 struct btrfs_root *root;
14 if (ac != 2) {
15 fprintf(stderr, "usage: %s device\n", av[0]);
16 exit(1);
18 radix_tree_init();
19 root = open_ctree(av[1], &super);
20 if (!root) {
21 fprintf(stderr, "unable to open %s\n", av[1]);
22 exit(1);
24 printf("fs tree\n");
25 btrfs_print_tree(root, root->node);
26 printf("map tree\n");
27 btrfs_print_tree(root->fs_info->extent_root,
28 root->fs_info->extent_root->node);
29 printf("inode tree\n");
30 btrfs_print_tree(root->fs_info->inode_root,
31 root->fs_info->inode_root->node);
32 printf("root tree\n");
33 btrfs_print_tree(root->fs_info->tree_root,
34 root->fs_info->tree_root->node);
35 printf("total blocks %Lu\n", btrfs_super_total_blocks(&super));
36 printf("blocks used %Lu\n", btrfs_super_blocks_used(&super));
37 return 0;