Btrfs-progs: fix misuse of skinny metadata in btrfs-image
authorLiu Bo <bo.li.liu@oracle.com>
Sat, 22 Jun 2013 05:32:41 +0000 (13:32 +0800)
committerChris Mason <chris.mason@fusionio.com>
Wed, 3 Jul 2013 18:16:09 +0000 (14:16 -0400)
As for skinny metadata, key.offset stores levels rather than extent length.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
btrfs-image.c

index 22239fe48a64e6692cd60069148a6a189e1c3357..30c1a9afc5be549045b9c0ce3a93e4632ada08f3 100644 (file)
@@ -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],