All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs-progs: ins: dump-tree: Small updates for extent tree output
@ 2018-05-30  4:55 Misono Tomohiro
  2018-05-30  4:55 ` [PATCH 1/2] btrfs-progs: ins: dump-tree: Use %lld for extent data backref offset Misono Tomohiro
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Misono Tomohiro @ 2018-05-30  4:55 UTC (permalink / raw)
  To: linux-btrfs

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(-)

-- 
2.14.3



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/2] btrfs-progs: ins: dump-tree: Use %lld for extent data backref offset
  2018-05-30  4:55 [PATCH 0/2] btrfs-progs: ins: dump-tree: Small updates for extent tree output Misono Tomohiro
@ 2018-05-30  4:55 ` Misono Tomohiro
  2018-05-30  4:55 ` [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref Misono Tomohiro
  2018-05-31 12:06 ` [PATCH 0/2] btrfs-progs: ins: dump-tree: Small updates for extent tree output David Sterba
  2 siblings, 0 replies; 9+ messages in thread
From: Misono Tomohiro @ 2018-05-30  4:55 UTC (permalink / raw)
  To: linux-btrfs

Offset of extent data backref in extent item can be negative.
So, let's use %lld insteand of %llu to output readable value.

Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
---
 print-tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/print-tree.c b/print-tree.c
index a1a7954a..90173c2b 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -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:
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref
  2018-05-30  4:55 [PATCH 0/2] btrfs-progs: ins: dump-tree: Small updates for extent tree output Misono Tomohiro
  2018-05-30  4:55 ` [PATCH 1/2] btrfs-progs: ins: dump-tree: Use %lld for extent data backref offset Misono Tomohiro
@ 2018-05-30  4:55 ` Misono Tomohiro
  2018-05-30  6:28   ` Nikolay Borisov
  2018-05-30  7:25   ` [PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree " Misono Tomohiro
  2018-05-31 12:06 ` [PATCH 0/2] btrfs-progs: ins: dump-tree: Small updates for extent tree output David Sterba
  2 siblings, 2 replies; 9+ messages in thread
From: Misono Tomohiro @ 2018-05-30  4:55 UTC (permalink / raw)
  To: linux-btrfs

Print tree name instead of number to make output more readable.

Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
---
 print-tree.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/print-tree.c b/print-tree.c
index 90173c2b..8d551d09 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -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",
-- 
2.14.3



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref
  2018-05-30  4:55 ` [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref Misono Tomohiro
@ 2018-05-30  6:28   ` Nikolay Borisov
  2018-05-30  6:55     ` Misono Tomohiro
  2018-05-30  7:25   ` [PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree " Misono Tomohiro
  1 sibling, 1 reply; 9+ messages in thread
From: Nikolay Borisov @ 2018-05-30  6:28 UTC (permalink / raw)
  To: Misono Tomohiro, linux-btrfs



On 30.05.2018 07:55, Misono Tomohiro wrote:
> Print tree name instead of number to make output more readable.
> 
> Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
> ---
>  print-tree.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/print-tree.c b/print-tree.c
> index 90173c2b..8d551d09 100644
> --- a/print-tree.c
> +++ b/print-tree.c
> @@ -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?

>  			break;
>  		case BTRFS_SHARED_BLOCK_REF_KEY:
>  			printf("\t\tshared block backref parent %llu\n",
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref
  2018-05-30  6:28   ` Nikolay Borisov
@ 2018-05-30  6:55     ` Misono Tomohiro
  2018-05-30  7:01       ` Nikolay Borisov
  0 siblings, 1 reply; 9+ messages in thread
From: Misono Tomohiro @ 2018-05-30  6:55 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs

On 2018/05/30 15:28, Nikolay Borisov wrote:
> 
> 
> On 30.05.2018 07:55, Misono Tomohiro wrote:
>> Print tree name instead of number to make output more readable.
>>
>> Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
>> ---
>>  print-tree.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/print-tree.c b/print-tree.c
>> index 90173c2b..8d551d09 100644
>> --- a/print-tree.c
>> +++ b/print-tree.c
>> @@ -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.

I overlooked it. So I will update the patch.

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?

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.

> 
>>  			break;
>>  		case BTRFS_SHARED_BLOCK_REF_KEY:
>>  			printf("\t\tshared block backref parent %llu\n",
>>
> 
> 


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref
  2018-05-30  6:55     ` Misono Tomohiro
@ 2018-05-30  7:01       ` Nikolay Borisov
  0 siblings, 0 replies; 9+ messages in thread
From: Nikolay Borisov @ 2018-05-30  7:01 UTC (permalink / raw)
  To: Misono Tomohiro, linux-btrfs



On 30.05.2018 09:55, Misono Tomohiro wrote:
> On 2018/05/30 15:28, Nikolay Borisov wrote:
>>
>>
>> On 30.05.2018 07:55, Misono Tomohiro wrote:
>>> Print tree name instead of number to make output more readable.
>>>
>>> Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
>>> ---
>>>  print-tree.c | 5 +++--
>>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/print-tree.c b/print-tree.c
>>> index 90173c2b..8d551d09 100644
>>> --- a/print-tree.c
>>> +++ b/print-tree.c
>>> @@ -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.
> 
> I overlooked it. So I will update the patch.
> 
> 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?
> 
> 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.

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.

> 
>>
>>>  			break;
>>>  		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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree block backref
  2018-05-30  4:55 ` [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref Misono Tomohiro
  2018-05-30  6:28   ` Nikolay Borisov
@ 2018-05-30  7:25   ` Misono Tomohiro
  2018-05-30  7:29     ` Nikolay Borisov
  1 sibling, 1 reply; 9+ messages in thread
From: Misono Tomohiro @ 2018-05-30  7:25 UTC (permalink / raw)
  To: linux-btrfs

Print 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

Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
---
 v1 -> v2
   - Update extent data backref too
   - Add output example

 print-tree.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/print-tree.c b/print-tree.c
index 90173c2b..c5be5e6c 100644
--- a/print-tree.c
+++ b/print-tree.c
@@ -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));
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree block backref
  2018-05-30  7:25   ` [PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree " Misono Tomohiro
@ 2018-05-30  7:29     ` Nikolay Borisov
  0 siblings, 0 replies; 9+ messages in thread
From: Nikolay Borisov @ 2018-05-30  7:29 UTC (permalink / raw)
  To: Misono Tomohiro, linux-btrfs



On 30.05.2018 10:25, Misono Tomohiro wrote:
> Print 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
> 
> Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>

LGTM:

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  v1 -> v2
>    - Update extent data backref too
>    - Add output example
> 
>  print-tree.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/print-tree.c b/print-tree.c
> index 90173c2b..c5be5e6c 100644
> --- a/print-tree.c
> +++ b/print-tree.c
> @@ -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));
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/2] btrfs-progs: ins: dump-tree: Small updates for extent tree output
  2018-05-30  4:55 [PATCH 0/2] btrfs-progs: ins: dump-tree: Small updates for extent tree output Misono Tomohiro
  2018-05-30  4:55 ` [PATCH 1/2] btrfs-progs: ins: dump-tree: Use %lld for extent data backref offset Misono Tomohiro
  2018-05-30  4:55 ` [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref Misono Tomohiro
@ 2018-05-31 12:06 ` David Sterba
  2 siblings, 0 replies; 9+ messages in thread
From: David Sterba @ 2018-05-31 12:06 UTC (permalink / raw)
  To: Misono Tomohiro; +Cc: linux-btrfs

On Wed, May 30, 2018 at 01:55:18PM +0900, Misono Tomohiro wrote:
> 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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-05-31 12:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-30  4:55 [PATCH 0/2] btrfs-progs: ins: dump-tree: Small updates for extent tree output Misono Tomohiro
2018-05-30  4:55 ` [PATCH 1/2] btrfs-progs: ins: dump-tree: Use %lld for extent data backref offset Misono Tomohiro
2018-05-30  4:55 ` [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref Misono Tomohiro
2018-05-30  6:28   ` Nikolay Borisov
2018-05-30  6:55     ` Misono Tomohiro
2018-05-30  7:01       ` Nikolay Borisov
2018-05-30  7:25   ` [PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree " Misono Tomohiro
2018-05-30  7:29     ` Nikolay Borisov
2018-05-31 12:06 ` [PATCH 0/2] btrfs-progs: ins: dump-tree: Small updates for extent tree output David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.