diff options
author | Yan <yanzheng@21cn.com> | 2008-01-04 10:38:22 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2008-01-04 10:38:22 -0500 |
commit | 7777e63b425f1444d2472ea05a6b2b9cf865f35b (patch) | |
tree | 257d9645b094cd3bae9051f7bb5b24d862764bf4 /debug-tree.c | |
parent | 088f78aeaadac6cc877975c6974731968c0093d1 (diff) |
Update btrfs-progs to match kernel sources
Diffstat (limited to 'debug-tree.c')
-rw-r--r-- | debug-tree.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/debug-tree.c b/debug-tree.c index e3530fed..368b8fb3 100644 --- a/debug-tree.c +++ b/debug-tree.c @@ -27,12 +27,11 @@ #include "transaction.h" int main(int ac, char **av) { - struct btrfs_super_block super; struct btrfs_root *root; struct btrfs_path path; struct btrfs_key key; - struct btrfs_root_item *ri; - struct btrfs_leaf *leaf; + struct btrfs_root_item ri; + struct extent_buffer *leaf; struct btrfs_key found_key; char uuidbuf[37]; int ret; @@ -43,7 +42,7 @@ int main(int ac, char **av) { exit(1); } radix_tree_init(); - root = open_ctree(av[1], &super); + root = open_ctree(av[1], 0); if (!root) { fprintf(stderr, "unable to open %s\n", av[1]); exit(1); @@ -59,23 +58,23 @@ int main(int ac, char **av) { &key, &path, 0, 0); BUG_ON(ret < 0); while(1) { - leaf = &path.nodes[0]->leaf; + leaf = path.nodes[0]; slot = path.slots[0]; - if (slot >= btrfs_header_nritems(&leaf->header)) { + if (slot >= btrfs_header_nritems(leaf)) { ret = btrfs_next_leaf(root, &path); if (ret != 0) break; - leaf = &path.nodes[0]->leaf; + leaf = path.nodes[0]; slot = path.slots[0]; } - btrfs_disk_key_to_cpu(&found_key, - &leaf->items[path.slots[0]].key); + btrfs_item_key_to_cpu(leaf, &found_key, path.slots[0]); if (btrfs_key_type(&found_key) == BTRFS_ROOT_ITEM_KEY) { - struct btrfs_buffer *buf; - ri = btrfs_item_ptr(leaf, path.slots[0], - struct btrfs_root_item); + unsigned long offset; + struct extent_buffer *buf; + offset = btrfs_item_ptr_offset(leaf, slot); + read_extent_buffer(leaf, &ri, offset, sizeof(ri)); buf = read_tree_block(root->fs_info->tree_root, - btrfs_root_bytenr(ri), + btrfs_root_bytenr(&ri), root->leafsize); switch(found_key.objectid) { case BTRFS_ROOT_TREE_OBJECTID: @@ -95,11 +94,11 @@ int main(int ac, char **av) { } btrfs_release_path(root, &path); printf("total bytes %llu\n", - (unsigned long long)btrfs_super_total_bytes(&super)); + (unsigned long long)btrfs_super_total_bytes(&root->fs_info->super_copy)); printf("bytes used %llu\n", - (unsigned long long)btrfs_super_bytes_used(&super)); + (unsigned long long)btrfs_super_bytes_used(&root->fs_info->super_copy)); uuidbuf[36] = '\0'; - uuid_unparse(super.fsid, uuidbuf); + uuid_unparse(root->fs_info->super_copy.fsid, uuidbuf); printf("uuid %s\n", uuidbuf); return 0; } |