diff mbox series

btrfs: tree-checker: Fix misleading group system information

Message ID 1541414949-16300-1-git-send-email-zhangshaokun@hisilicon.com (mailing list archive)
State New, archived
Headers show
Series btrfs: tree-checker: Fix misleading group system information | expand

Commit Message

Shaokun Zhang Nov. 5, 2018, 10:49 a.m. UTC
block_group_err shows the group system as a decimal value with a '0x'
prefix, which is somewhat misleading.

Fix it to print hexadecimal, as was intended.

Cc: David Sterba <dsterba@suse.com> 
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <josef@toxicpanda.com> 
Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
---
 fs/btrfs/tree-checker.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nikolay Borisov Nov. 5, 2018, 10:52 a.m. UTC | #1
On 5.11.18 г. 12:49 ч., Shaokun Zhang wrote:
> block_group_err shows the group system as a decimal value with a '0x'
> prefix, which is somewhat misleading.
> 
> Fix it to print hexadecimal, as was intended.
> 
> Cc: David Sterba <dsterba@suse.com> 
> Cc: Chris Mason <clm@fb.com>
> Cc: Josef Bacik <josef@toxicpanda.com> 
> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>

Good catch !

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

> ---
>  fs/btrfs/tree-checker.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
> index cab0b1f..efcf89a 100644
> --- a/fs/btrfs/tree-checker.c
> +++ b/fs/btrfs/tree-checker.c
> @@ -440,7 +440,7 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info,
>  	    type != (BTRFS_BLOCK_GROUP_METADATA |
>  			   BTRFS_BLOCK_GROUP_DATA)) {
>  		block_group_err(fs_info, leaf, slot,
> -"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx",
> +"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx",
>  			type, hweight64(type),
>  			BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA,
>  			BTRFS_BLOCK_GROUP_SYSTEM,
>
Qu Wenruo Nov. 5, 2018, 11:03 a.m. UTC | #2
On 2018/11/5 下午6:49, Shaokun Zhang wrote:
> block_group_err shows the group system as a decimal value with a '0x'
> prefix, which is somewhat misleading.
> 
> Fix it to print hexadecimal, as was intended.
> 
> Cc: David Sterba <dsterba@suse.com> 
> Cc: Chris Mason <clm@fb.com>
> Cc: Josef Bacik <josef@toxicpanda.com> 
> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

BTW, did you catch it with some real world case or just by looking into
the code?

Thanks,
Qu

> ---
>  fs/btrfs/tree-checker.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
> index cab0b1f..efcf89a 100644
> --- a/fs/btrfs/tree-checker.c
> +++ b/fs/btrfs/tree-checker.c
> @@ -440,7 +440,7 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info,
>  	    type != (BTRFS_BLOCK_GROUP_METADATA |
>  			   BTRFS_BLOCK_GROUP_DATA)) {
>  		block_group_err(fs_info, leaf, slot,
> -"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx",
> +"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx",
>  			type, hweight64(type),
>  			BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA,
>  			BTRFS_BLOCK_GROUP_SYSTEM,
>
Shaokun Zhang Nov. 5, 2018, 11:33 a.m. UTC | #3
Hi Qu,

On 2018/11/5 19:03, Qu Wenruo wrote:
> 
> 
> On 2018/11/5 下午6:49, Shaokun Zhang wrote:
>> block_group_err shows the group system as a decimal value with a '0x'
>> prefix, which is somewhat misleading.
>>
>> Fix it to print hexadecimal, as was intended.
>>
>> Cc: David Sterba <dsterba@suse.com> 
>> Cc: Chris Mason <clm@fb.com>
>> Cc: Josef Bacik <josef@toxicpanda.com> 
>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
> 
> Reviewed-by: Qu Wenruo <wqu@suse.com>
> 
> BTW, did you catch it with some real world case or just by looking into
> the code?

I made a mistake (0x%d) when debugged my code, so I grep the similar format
for the kernel code and came across this typo, a trivial patch.

Thanks,
Shaokun

> 
> Thanks,
> Qu
> 
>> ---
>>  fs/btrfs/tree-checker.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
>> index cab0b1f..efcf89a 100644
>> --- a/fs/btrfs/tree-checker.c
>> +++ b/fs/btrfs/tree-checker.c
>> @@ -440,7 +440,7 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info,
>>  	    type != (BTRFS_BLOCK_GROUP_METADATA |
>>  			   BTRFS_BLOCK_GROUP_DATA)) {
>>  		block_group_err(fs_info, leaf, slot,
>> -"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx",
>> +"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx",
>>  			type, hweight64(type),
>>  			BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA,
>>  			BTRFS_BLOCK_GROUP_SYSTEM,
>>
>
Qu Wenruo Nov. 5, 2018, 2:42 p.m. UTC | #4
On 2018/11/5 下午7:33, Zhangshaokun wrote:
> Hi Qu,
> 
> On 2018/11/5 19:03, Qu Wenruo wrote:
>>
>>
>> On 2018/11/5 下午6:49, Shaokun Zhang wrote:
>>> block_group_err shows the group system as a decimal value with a '0x'
>>> prefix, which is somewhat misleading.
>>>
>>> Fix it to print hexadecimal, as was intended.
>>>
>>> Cc: David Sterba <dsterba@suse.com> 
>>> Cc: Chris Mason <clm@fb.com>
>>> Cc: Josef Bacik <josef@toxicpanda.com> 
>>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
>>
>> Reviewed-by: Qu Wenruo <wqu@suse.com>
>>
>> BTW, did you catch it with some real world case or just by looking into
>> the code?
> 
> I made a mistake (0x%d) when debugged my code, so I grep the similar format
> for the kernel code and came across this typo, a trivial patch.

Ok, that's fine.

Just a small tip for your further involvement in kernel, for such small
fix, there is really no need to bother all the maintainers.

You could just use "git blame" to find who is causing the problem, in
this case it's me unfortunately :( , and Cc that guy.

Furthermore, you could add a "fixes:" tag.
About these common tags, you could refer to 'Describe your changes'
section of 'Documentation/process/submitting-patches.rst'.

Thanks,
Qu

> 
> Thanks,
> Shaokun
> 
>>
>> Thanks,
>> Qu
>>
>>> ---
>>>  fs/btrfs/tree-checker.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
>>> index cab0b1f..efcf89a 100644
>>> --- a/fs/btrfs/tree-checker.c
>>> +++ b/fs/btrfs/tree-checker.c
>>> @@ -440,7 +440,7 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info,
>>>  	    type != (BTRFS_BLOCK_GROUP_METADATA |
>>>  			   BTRFS_BLOCK_GROUP_DATA)) {
>>>  		block_group_err(fs_info, leaf, slot,
>>> -"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx",
>>> +"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx",
>>>  			type, hweight64(type),
>>>  			BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA,
>>>  			BTRFS_BLOCK_GROUP_SYSTEM,
>>>
>>
>
David Sterba Nov. 5, 2018, 4:36 p.m. UTC | #5
On Mon, Nov 05, 2018 at 06:49:09PM +0800, Shaokun Zhang wrote:
> block_group_err shows the group system as a decimal value with a '0x'
> prefix, which is somewhat misleading.

Thanks. As this is user visible I'll add stable tag and get it to 4.20
in the next rc.
Shaokun Zhang Nov. 6, 2018, 1:09 a.m. UTC | #6
Hi Qu,

On 2018/11/5 22:42, Qu Wenruo wrote:
> 
> 
> On 2018/11/5 下午7:33, Zhangshaokun wrote:
>> Hi Qu,
>>
>> On 2018/11/5 19:03, Qu Wenruo wrote:
>>>
>>>
>>> On 2018/11/5 下午6:49, Shaokun Zhang wrote:
>>>> block_group_err shows the group system as a decimal value with a '0x'
>>>> prefix, which is somewhat misleading.
>>>>
>>>> Fix it to print hexadecimal, as was intended.
>>>>
>>>> Cc: David Sterba <dsterba@suse.com> 
>>>> Cc: Chris Mason <clm@fb.com>
>>>> Cc: Josef Bacik <josef@toxicpanda.com> 
>>>> Signed-off-by: Shaokun Zhang <zhangshaokun@hisilicon.com>
>>>
>>> Reviewed-by: Qu Wenruo <wqu@suse.com>
>>>
>>> BTW, did you catch it with some real world case or just by looking into
>>> the code?
>>
>> I made a mistake (0x%d) when debugged my code, so I grep the similar format
>> for the kernel code and came across this typo, a trivial patch.
> 
> Ok, that's fine.
> 
> Just a small tip for your further involvement in kernel, for such small
> fix, there is really no need to bother all the maintainers.
> 

My apologies for the noise to all the maintainers. I shall pay more attention
on it.

> You could just use "git blame" to find who is causing the problem, in
> this case it's me unfortunately :( , and Cc that guy.
> 

In fact, I really used the "git blame" and saw it from your patch. While I
use the get_maintainer.pl and Cc them directly, forgot to Cc you. I will
do what you said for the further work.

> Furthermore, you could add a "fixes:" tag.
> About these common tags, you could refer to 'Describe your changes'
> section of 'Documentation/process/submitting-patches.rst'.
> 

Sure, thanks for your nice guidance.

Shaokun

> Thanks,
> Qu
> 
>>
>> Thanks,
>> Shaokun
>>
>>>
>>> Thanks,
>>> Qu
>>>
>>>> ---
>>>>  fs/btrfs/tree-checker.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
>>>> index cab0b1f..efcf89a 100644
>>>> --- a/fs/btrfs/tree-checker.c
>>>> +++ b/fs/btrfs/tree-checker.c
>>>> @@ -440,7 +440,7 @@ static int check_block_group_item(struct btrfs_fs_info *fs_info,
>>>>  	    type != (BTRFS_BLOCK_GROUP_METADATA |
>>>>  			   BTRFS_BLOCK_GROUP_DATA)) {
>>>>  		block_group_err(fs_info, leaf, slot,
>>>> -"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx",
>>>> +"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx",
>>>>  			type, hweight64(type),
>>>>  			BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA,
>>>>  			BTRFS_BLOCK_GROUP_SYSTEM,
>>>>
>>>
>>
>
diff mbox series

Patch

diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c
index cab0b1f..efcf89a 100644
--- a/fs/btrfs/tree-checker.c
+++ b/fs/btrfs/tree-checker.c
@@ -440,7 +440,7 @@  static int check_block_group_item(struct btrfs_fs_info *fs_info,
 	    type != (BTRFS_BLOCK_GROUP_METADATA |
 			   BTRFS_BLOCK_GROUP_DATA)) {
 		block_group_err(fs_info, leaf, slot,
-"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llu or 0x%llx",
+"invalid type, have 0x%llx (%lu bits set) expect either 0x%llx, 0x%llx, 0x%llx or 0x%llx",
 			type, hweight64(type),
 			BTRFS_BLOCK_GROUP_DATA, BTRFS_BLOCK_GROUP_METADATA,
 			BTRFS_BLOCK_GROUP_SYSTEM,