As for skinny metadata, key.offset stores levels rather than extent length.

Signed-off-by: Liu Bo <bo.li....@oracle.com>
---
 btrfs-image.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/btrfs-image.c b/btrfs-image.c
index 22239fe..30c1a9a 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -1169,9 +1169,9 @@ static int copy_from_extent_tree(struct metadump_struct 
*metadump,
 
                bytenr = key.objectid;
                if (key.type == BTRFS_METADATA_ITEM_KEY)
-                       num_bytes = key.offset;
-               else
                        num_bytes = extent_root->leafsize;
+               else
+                       num_bytes = key.offset;
 
                if (btrfs_item_size_nr(leaf, path->slots[0]) > sizeof(*ei)) {
                        ei = btrfs_item_ptr(leaf, path->slots[0],
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to