From 7b20da8d525d11dabc98bdd49efef7b8be5576ab Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Fri, 15 Mar 2013 15:32:16 -0400 Subject: Btrfs-progs: add skinny metadata support to progs V3 This fixes up the progs to properly deal with skinny metadata. This adds the -x option to mkfs and btrfstune for enabling the skinny metadata option. This also makes changes to fsck so it can properly deal with the skinny metadata entries. Thanks, Signed-off-by: Josef Bacik --- print-tree.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'print-tree.c') diff --git a/print-tree.c b/print-tree.c index c9e891bc..49c83840 100644 --- a/print-tree.c +++ b/print-tree.c @@ -202,7 +202,7 @@ static void print_file_extent_item(struct extent_buffer *eb, btrfs_file_extent_compression(eb, fi)); } -static void print_extent_item(struct extent_buffer *eb, int slot) +static void print_extent_item(struct extent_buffer *eb, int slot, int metadata) { struct btrfs_extent_item *ei; struct btrfs_extent_inline_ref *iref; @@ -237,7 +237,7 @@ static void print_extent_item(struct extent_buffer *eb, int slot) (unsigned long long)btrfs_extent_generation(eb, ei), (unsigned long long)flags); - if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { + if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK && !metadata) { struct btrfs_tree_block_info *info; info = (struct btrfs_tree_block_info *)(ei + 1); btrfs_tree_block_key(eb, info, &key); @@ -245,7 +245,13 @@ static void print_extent_item(struct extent_buffer *eb, int slot) btrfs_print_key(&key); printf(" level %d\n", btrfs_tree_block_level(eb, info)); iref = (struct btrfs_extent_inline_ref *)(info + 1); - } else { + } else if (metadata) { + struct btrfs_key tmp; + + btrfs_item_key_to_cpu(eb, &tmp, slot); + printf("\t\ttree block skinny level %d\n", (int)tmp.offset); + iref = (struct btrfs_extent_inline_ref *)(ei + 1); + } else{ iref = (struct btrfs_extent_inline_ref *)(ei + 1); } @@ -440,6 +446,9 @@ static void print_key_type(u64 objectid, u8 type) case BTRFS_EXTENT_ITEM_KEY: printf("EXTENT_ITEM"); break; + case BTRFS_METADATA_ITEM_KEY: + printf("METADATA_ITEM"); + break; case BTRFS_TREE_BLOCK_REF_KEY: printf("TREE_BLOCK_REF"); break; @@ -699,7 +708,10 @@ void btrfs_print_leaf(struct btrfs_root *root, struct extent_buffer *l) print_root_ref(l, i, "backref"); break; case BTRFS_EXTENT_ITEM_KEY: - print_extent_item(l, i); + print_extent_item(l, i, 0); + break; + case BTRFS_METADATA_ITEM_KEY: + print_extent_item(l, i, 1); break; case BTRFS_TREE_BLOCK_REF_KEY: printf("\t\ttree block backref\n"); -- cgit v1.2.3