btrfs-progs: ins: dump-tree: Small updates for extent tree output
cover btrfs-progs: ins: dump-tree: Small updates for extent tree output
Two small updates for extent tree to make output more human readable.
Misono Tomohiro (2):
btrfs-progs: ins: dump-tree: Use %lld for extent data backref offset
btrfs-progs: ins: dump-tree: Print tree name for tree block backref
print-tree.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.14.3
PATCH 1/2 btrfs-progs: ins: dump-tree: Use %lld for extent data backref offset
Offset of extent data backref in extent item can be negative. So, let's use %lld insteand of %llu to output readable value.
--- print-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
print-tree.c +2 -2
@@ -480,10 +480,10 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata)case BTRFS_EXTENT_DATA_REF_KEY : dref = (struct btrfs_extent_data_ref *)(&iref->offset);printf ("\t\textent data backref root %llu " -"objectid %llu offset %llu count %u\n" , +"objectid %llu offset %lld count %u\n" , (unsigned long long )btrfs_extent_data_ref_root (eb, dref), (unsigned long long )btrfs_extent_data_ref_objectid (eb, dref), - (unsigned long long )btrfs_extent_data_ref_offset (eb, dref), +btrfs_extent_data_ref_offset (eb, dref),btrfs_extent_data_ref_count (eb, dref));break ;case BTRFS_SHARED_DATA_REF_KEY :
Signature · 1 line
2.14.3
PATCH 2/2 btrfs-progs: ins: dump-tree: Print tree name for tree block backref
In reply to Misono TomohiroPrint tree name instead of number to make output more readable.
--- print-tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
print-tree.c +3 -2
@@ -470,8 +470,9 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata) offset =btrfs_extent_inline_ref_offset (eb, iref);switch (type) {case BTRFS_TREE_BLOCK_REF_KEY : -printf ("\t\ttree block backref root %llu\n" , - (unsigned long long )offset); +printf ("\t\ttree block backref root " ); +print_objectid (stdout, offset,0 ); +printf ("\n" );break ;case BTRFS_SHARED_BLOCK_REF_KEY : printf("\t\tshared block backref parent %llu\n",
Signature · 1 line
2.14.3
Re: [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref
Quoted 12 lines · Misono Tomohiro
Print tree name instead of number to make output more readable.
Signed-off-by Misono Tomohiro <[email protected]>--- print-tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)print-tree.c +0
-0
print-tree.c void print_extent_item(struct extent_buffer *eb, int slot, int metadata) · line 475
Quoted 8 lines
print-tree.c +3
-2@@ -470,8 +470,9 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata) offset =btrfs_extent_inline_ref_offset (eb, iref);switch (type) {case BTRFS_TREE_BLOCK_REF_KEY : -printf ("\t\ttree block backref root %llu\n" , - (unsigned long long )offset); +printf ("\t\ttree block backref root " ); +print_objectid (stdout, offset,0 ); +printf ("\n" );
So this is a good change, yet one thing I'd like to know is if I'm inspecting the extent tree with say "btrfs inspect-internal dump-tree -t 2" and I see a record :
item 14 key (14540800 EXTENT_ITEM 4096) itemoff 15488 itemsize 53
refs 1 gen 12 flags DATA
extent data backref root 5 objectid 479 offset 0 count 1
it will in fact be "root FS_TREE" or some such. So the question is will I bee able to use the printed string as an argument to -t ? Because on one hand I as a user would like to make sense of the output I'm seeing (hence the string is welcomed) at the same time I'd like to know that i can reference the tree with -t option without having to go and figure out what's the numeric id?
Quoted 4 lines
print-tree.c +0
-0break ;case BTRFS_SHARED_BLOCK_REF_KEY : printf("\t\tshared block backref parent %llu\n",
Re: [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref
Quoted 28 lines · Nikolay Borisov
Quoted 12 lines · Misono Tomohiro
Print tree name instead of number to make output more readable.
Signed-off-by Misono Tomohiro <[email protected]>--- print-tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)print-tree.c +0
-0print-tree.c void print_extent_item(struct extent_buffer *eb, int slot, int metadata) · line 475
Quoted 8 lines
print-tree.c +3
-2@@ -470,8 +470,9 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata) offset =btrfs_extent_inline_ref_offset (eb, iref);switch (type) {case BTRFS_TREE_BLOCK_REF_KEY : -printf ("\t\ttree block backref root %llu\n" , - (unsigned long long )offset); +printf ("\t\ttree block backref root " ); +print_objectid (stdout, offset,0 ); +printf ("\n" );So this is a good change, yet one thing I'd like to know is if I'm inspecting the extent tree with say "btrfs inspect-internal dump-tree -t 2" and I see a record :
Quoted 5 lines
item 14 key (14540800
EXTENT_ITEM4096) itemoff 15488 itemsize 53
refs 1 gen 12 flags DATA
extent data backref root 5 objectid 479 offset 0 count 1it will in fact be "root
FS_TREE" or some such.
I overlooked it. So I will update the patch.
So the question is will
Quoted 5 lines
I bee able to use the printed string as an argument to -t ? Because on one hand I as a user would like to make sense of the output I'm seeing (hence the string is welcomed) at the same time I'd like to know that i can reference the tree with -t option without having to go and figure out what's the numeric id?
I looked the code and just now realized that we can already use tree name for -t like "btrfs ins dump-tree -t EXTNET $DEV".
Please see treeid_from_string() in inspect-dump-tree.c.
Quoted 7 lines
Quoted 5 lines
print-tree.c +0
-0break ;case BTRFS_SHARED_BLOCK_REF_KEY : printf("\t\tshared block backref parent %llu\n",
Re: [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref
Quoted 44 lines · Misono Tomohiro
Quoted 28 lines · Nikolay Borisov
Quoted 12 lines · Misono Tomohiro
Print tree name instead of number to make output more readable.
Signed-off-by Misono Tomohiro <[email protected]>--- print-tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)print-tree.c +0
-0print-tree.c void print_extent_item(struct extent_buffer *eb, int slot, int metadata) · line 475
Quoted 8 lines
print-tree.c +3
-2@@ -470,8 +470,9 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata) offset =btrfs_extent_inline_ref_offset (eb, iref);switch (type) {case BTRFS_TREE_BLOCK_REF_KEY : -printf ("\t\ttree block backref root %llu\n" , - (unsigned long long )offset); +printf ("\t\ttree block backref root " ); +print_objectid (stdout, offset,0 ); +printf ("\n" );So this is a good change, yet one thing I'd like to know is if I'm inspecting the extent tree with say "btrfs inspect-internal dump-tree -t 2" and I see a record :
Quoted 5 lines
item 14 key (14540800
EXTENT_ITEM4096) itemoff 15488 itemsize 53
refs 1 gen 12 flags DATA
extent data backref root 5 objectid 479 offset 0 count 1it will in fact be "root
FS_TREE" or some such.I overlooked it. So I will update the patch.
So the question is will
Quoted 5 lines
I bee able to use the printed string as an argument to -t ? Because on one hand I as a user would like to make sense of the output I'm seeing (hence the string is welcomed) at the same time I'd like to know that i can reference the tree with -t option without having to go and figure out what's the numeric id?
Quoted 3 lines
I looked the code and just now realized that we can already use tree name for -t like "btrfs ins dump-tree -t EXTNET $DEV".
Please seetreeid_from_string()ininspect-dump-tree.c.
I know we can use tree names what I wanted to know is that the strings printed from print_objectid aer going to be compatible with that. I will take your reply as a "yes" in that case.
Quoted 14 lines
Quoted 8 lines
print-tree.c void print_extent_item(struct extent_buffer *eb, int slot, int metadata) · line 478
Quoted 6 lines
print-tree.c +0
-0break ;case BTRFS_SHARED_BLOCK_REF_KEY : printf("\t\tshared block backref parent %llu\n",--
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
PATCH v2 2/2 btrfs-progs: ins: dump-tree: Print tree name for extent data/tree block backref
In reply to Misono TomohiroPrint tree name instead of number to make output more readable.
Example:
[before]
extent data backref root 5 objectid 257 offset 16384 count 1
tree block backref root 18446744073709551607
[after]
extent data backref root FS_TREE objectid 257 offset 16384 count 1
tree block backref root DATA_RELOC_TREE
---
v1 -> v2
- Update extent data backref too
- Add output example
print-tree.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
print-tree.c +11 -8
@@ -470,8 +470,9 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata) offset =btrfs_extent_inline_ref_offset (eb, iref);switch (type) {case BTRFS_TREE_BLOCK_REF_KEY : -printf ("\t\ttree block backref root %llu\n" , - (unsigned long long )offset); +printf ("\t\ttree block backref root " ); +print_objectid (stdout, offset,0 ); +printf ("\n" );break ;case BTRFS_SHARED_BLOCK_REF_KEY : printf("\t\tshared block backref parent %llu\n",
@@ -479,9 +480,10 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata)break ;case BTRFS_EXTENT_DATA_REF_KEY : dref = (struct btrfs_extent_data_ref *)(&iref->offset); -printf ("\t\textent data backref root %llu " -"objectid %llu offset %lld count %u\n" , - (unsigned long long )btrfs_extent_data_ref_root (eb, dref), +printf ("\t\textent data backref root " ); +print_objectid (stdout, + (unsigned long long )btrfs_extent_data_ref_root (eb, dref),0 ); +printf (" objectid %llu offset %lld count %u\n" , (unsigned long long )btrfs_extent_data_ref_objectid (eb, dref),btrfs_extent_data_ref_offset (eb, dref),btrfs_extent_data_ref_count (eb, dref));
@@ -1018,9 +1020,10 @@ static void print_extent_data_ref(struct extent_buffer *eb, int slot)struct btrfs_extent_data_ref *dref; dref = btrfs_item_ptr(eb, slot, struct btrfs_extent_data_ref); -printf ("\t\textent data backref root %llu " -"objectid %llu offset %llu count %u\n" , - (unsigned long long )btrfs_extent_data_ref_root (eb, dref), +printf ("\t\textent data backref root " ); +print_objectid (stdout, + (unsigned long long )btrfs_extent_data_ref_root (eb, dref),0 ); +printf (" objectid %llu offset %llu count %u\n" , (unsigned long long )btrfs_extent_data_ref_objectid (eb, dref), (unsigned long long )btrfs_extent_data_ref_offset (eb, dref),btrfs_extent_data_ref_count (eb, dref));
Signature · 1 line
2.14.3
Re: [PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree block backref
Quoted 6 lines · Misono Tomohiro
Print tree name instead of number to make output more readable.
Example:
[before]
extent data backref root 5 objectid 257 offset 16384 count 1
Quoted 8 lines
tree block backref root 18446744073709551607[after]
extent data backref rootFS_TREEobjectid 257 offset 16384 count 1tree block backref root
DATA_RELOC_TREESigned-off-by Misono Tomohiro <[email protected]>
LGTM:
Quoted 53 lines
---
v1 -> v2
- Update extent data backref too
- Add output exampleprint-tree.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)print-tree.c +11
-8@@ -470,8 +470,9 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata) offset =btrfs_extent_inline_ref_offset (eb, iref);switch (type) {case BTRFS_TREE_BLOCK_REF_KEY : -printf ("\t\ttree block backref root %llu\n" , - (unsigned long long )offset); +printf ("\t\ttree block backref root " ); +print_objectid (stdout, offset,0 ); +printf ("\n" );break ;case BTRFS_SHARED_BLOCK_REF_KEY : printf("\t\tshared block backref parent %llu\n",@@ -479,9 +480,10 @@ void print_extent_item(struct extent_buffer *eb, int slot, int metadata)break ;case BTRFS_EXTENT_DATA_REF_KEY : dref = (struct btrfs_extent_data_ref *)(&iref->offset); -printf ("\t\textent data backref root %llu " -"objectid %llu offset %lld count %u\n" , - (unsigned long long )btrfs_extent_data_ref_root (eb, dref), +printf ("\t\textent data backref root " ); +print_objectid (stdout, + (unsigned long long )btrfs_extent_data_ref_root (eb, dref),0 ); +printf (" objectid %llu offset %lld count %u\n" , (unsigned long long )btrfs_extent_data_ref_objectid (eb, dref),btrfs_extent_data_ref_offset (eb, dref),btrfs_extent_data_ref_count (eb, dref));@@ -1018,9 +1020,10 @@ static void print_extent_data_ref(struct extent_buffer *eb, int slot)struct btrfs_extent_data_ref *dref; dref = btrfs_item_ptr(eb, slot, struct btrfs_extent_data_ref); -printf ("\t\textent data backref root %llu " -"objectid %llu offset %llu count %u\n" , - (unsigned long long )btrfs_extent_data_ref_root (eb, dref), +printf ("\t\textent data backref root " ); +print_objectid (stdout, + (unsigned long long )btrfs_extent_data_ref_root (eb, dref),0 ); +printf (" objectid %llu offset %llu count %u\n" , (unsigned long long )btrfs_extent_data_ref_objectid (eb, dref), (unsigned long long )btrfs_extent_data_ref_offset (eb, dref),btrfs_extent_data_ref_count (eb, dref));
David Sterba
AppliedQuoted 5 lines · Misono Tomohiro
Two small updates for extent tree to make output more human readable.
Misono Tomohiro (2):
btrfs-progs: ins: dump-tree: Use %lld for extent data backref offset
btrfs-progs: ins: dump-tree: Print tree name for tree block backref
Applied, thanks.