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 <[email protected]>
---
 debug-tree.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/debug-tree.c b/debug-tree.c
index 40628e0..cf637ab 100644
--- a/debug-tree.c
+++ b/debug-tree.c
@@ -208,7 +208,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)
-- 
1.7.0.1
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to