btrfs-progs: fix wrong extent buffer size when reading tree block
authorMiao Xie <miaox@cn.fujitsu.com>
Tue, 13 Jul 2010 09:18:04 +0000 (09:18 +0000)
committerChris Mason <chris.mason@oracle.com>
Tue, 25 Oct 2011 13:18:31 +0000 (09:18 -0400)
the root extent buffer of a tree may not be a leaf, so we must get the right
size by its level when reading it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
debug-tree.c

index 0525354..99c12d6 100644 (file)
@@ -212,7 +212,9 @@ again:
                        read_extent_buffer(leaf, &ri, offset, sizeof(ri));
                        buf = read_tree_block(tree_root_scan,
                                              btrfs_root_bytenr(&ri),
-                                             tree_root_scan->leafsize, 0);
+                                             btrfs_level_size(tree_root_scan,
+                                                       btrfs_root_level(&ri)),
+                                             0);
                        switch(found_key.objectid) {
                        case BTRFS_ROOT_TREE_OBJECTID:
                                if (!skip)