csum data struct changes
[platform/upstream/btrfs-progs.git] / debug-tree.c
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"
9
10 int main(int ac, char **av) {
11         struct btrfs_super_block super;
12         struct btrfs_root *root;
13
14         if (ac != 2) {
15                 fprintf(stderr, "usage: %s device\n", av[0]);
16                 exit(1);
17         }
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);
23         }
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;
38 }