* [PATCH] btrfs-progs: trivial code style fix in root-tree.c
@ 2012-08-16 13:17 Wang Sheng-Hui
2012-08-16 13:23 ` Arne Jansen
0 siblings, 1 reply; 5+ messages in thread
From: Wang Sheng-Hui @ 2012-08-16 13:17 UTC (permalink / raw)
To: linux-btrfs
Add code indent to the bad styled statements.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
root-tree.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/root-tree.c b/root-tree.c
index 782472c..39cfef6 100644
--- a/root-tree.c
+++ b/root-tree.c
@@ -182,12 +182,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
if (ret < 0)
goto out;
if (ret) {
-btrfs_print_leaf(root, path->nodes[0]);
-printk("failed to del %llu %u %llu\n",
- (unsigned long long)key->objectid,
- key->type,
- (unsigned long long)key->offset);
-
+ btrfs_print_leaf(root, path->nodes[0]);
+ printk("failed to del %llu %u %llu\n",
+ (unsigned long long)key->objectid, key->type,
+ (unsigned long long)key->offset);
}
BUG_ON(ret != 0);
leaf = path->nodes[0];
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs-progs: trivial code style fix in root-tree.c
2012-08-16 13:17 [PATCH] btrfs-progs: trivial code style fix in root-tree.c Wang Sheng-Hui
@ 2012-08-16 13:23 ` Arne Jansen
2012-08-16 13:26 ` Wang Sheng-Hui
0 siblings, 1 reply; 5+ messages in thread
From: Arne Jansen @ 2012-08-16 13:23 UTC (permalink / raw)
To: Wang Sheng-Hui; +Cc: linux-btrfs
On 16.08.2012 15:17, Wang Sheng-Hui wrote:
> Add code indent to the bad styled statements.
>
> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
> ---
> root-tree.c | 10 ++++------
> 1 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/root-tree.c b/root-tree.c
> index 782472c..39cfef6 100644
> --- a/root-tree.c
> +++ b/root-tree.c
> @@ -182,12 +182,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
> if (ret < 0)
> goto out;
> if (ret) {
> -btrfs_print_leaf(root, path->nodes[0]);
> -printk("failed to del %llu %u %llu\n",
> - (unsigned long long)key->objectid,
> - key->type,
> - (unsigned long long)key->offset);
> -
I guess Alexander intentionally put in the bad indentation
to remind him to remove this code before submitting the
patch :)
> + btrfs_print_leaf(root, path->nodes[0]);
> + printk("failed to del %llu %u %llu\n",
> + (unsigned long long)key->objectid, key->type,
> + (unsigned long long)key->offset);
> }
> BUG_ON(ret != 0);
> leaf = path->nodes[0];
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs-progs: trivial code style fix in root-tree.c
2012-08-16 13:23 ` Arne Jansen
@ 2012-08-16 13:26 ` Wang Sheng-Hui
2012-08-16 13:30 ` Arne Jansen
0 siblings, 1 reply; 5+ messages in thread
From: Wang Sheng-Hui @ 2012-08-16 13:26 UTC (permalink / raw)
To: Arne Jansen; +Cc: linux-btrfs
On 2012年08月16日 21:23, Arne Jansen wrote:
> On 16.08.2012 15:17, Wang Sheng-Hui wrote:
>> Add code indent to the bad styled statements.
>>
>> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
>> ---
>> root-tree.c | 10 ++++------
>> 1 files changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/root-tree.c b/root-tree.c
>> index 782472c..39cfef6 100644
>> --- a/root-tree.c
>> +++ b/root-tree.c
>> @@ -182,12 +182,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
>> if (ret < 0)
>> goto out;
>> if (ret) {
>> -btrfs_print_leaf(root, path->nodes[0]);
>> -printk("failed to del %llu %u %llu\n",
>> - (unsigned long long)key->objectid,
>> - key->type,
>> - (unsigned long long)key->offset);
>> -
>
> I guess Alexander intentionally put in the bad indentation
> to remind him to remove this code before submitting the
> patch :)
>
>> + btrfs_print_leaf(root, path->nodes[0]);
>> + printk("failed to del %llu %u %llu\n",
>> + (unsigned long long)key->objectid, key->type,
>> + (unsigned long long)key->offset);
>> }
When I saw the BUG_ON, I wonder do we still need the above branch statement.
It looks just to be helpful for debug - give out some info, right?
>> BUG_ON(ret != 0);
>> leaf = path->nodes[0];
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs-progs: trivial code style fix in root-tree.c
2012-08-16 13:26 ` Wang Sheng-Hui
@ 2012-08-16 13:30 ` Arne Jansen
2012-08-16 14:25 ` Wang Sheng-Hui
0 siblings, 1 reply; 5+ messages in thread
From: Arne Jansen @ 2012-08-16 13:30 UTC (permalink / raw)
To: Wang Sheng-Hui; +Cc: linux-btrfs
On 16.08.2012 15:26, Wang Sheng-Hui wrote:
> On 2012年08月16日 21:23, Arne Jansen wrote:
>> On 16.08.2012 15:17, Wang Sheng-Hui wrote:
>>> Add code indent to the bad styled statements.
>>>
>>> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
>>> ---
>>> root-tree.c | 10 ++++------
>>> 1 files changed, 4 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/root-tree.c b/root-tree.c
>>> index 782472c..39cfef6 100644
>>> --- a/root-tree.c
>>> +++ b/root-tree.c
>>> @@ -182,12 +182,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
>>> if (ret < 0)
>>> goto out;
>>> if (ret) {
>>> -btrfs_print_leaf(root, path->nodes[0]);
>>> -printk("failed to del %llu %u %llu\n",
>>> - (unsigned long long)key->objectid,
>>> - key->type,
>>> - (unsigned long long)key->offset);
>>> -
>>
>> I guess Alexander intentionally put in the bad indentation
>> to remind him to remove this code before submitting the
>> patch :)
>>
>>> + btrfs_print_leaf(root, path->nodes[0]);
>>> + printk("failed to del %llu %u %llu\n",
>>> + (unsigned long long)key->objectid, key->type,
>>> + (unsigned long long)key->offset);
>>> }
>
> When I saw the BUG_ON, I wonder do we still need the above branch statement.
> It looks just to be helpful for debug - give out some info, right?
Yes. So either we delete it completely or we move the BUG_ON
into the block as a BUG_ON(1) and add a "Btrfs: "-prefix to the
printk.
On the other hand, I just saw this is progs, so I think it can
just be deleted.
>
>>> BUG_ON(ret != 0);
>>> leaf = path->nodes[0];
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] btrfs-progs: trivial code style fix in root-tree.c
2012-08-16 13:30 ` Arne Jansen
@ 2012-08-16 14:25 ` Wang Sheng-Hui
0 siblings, 0 replies; 5+ messages in thread
From: Wang Sheng-Hui @ 2012-08-16 14:25 UTC (permalink / raw)
To: Arne Jansen; +Cc: linux-btrfs
On 2012年08月16日 21:30, Arne Jansen wrote:
> On 16.08.2012 15:26, Wang Sheng-Hui wrote:
>> On 2012年08月16日 21:23, Arne Jansen wrote:
>>> On 16.08.2012 15:17, Wang Sheng-Hui wrote:
>>>> Add code indent to the bad styled statements.
>>>>
>>>> Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
>>>> ---
>>>> root-tree.c | 10 ++++------
>>>> 1 files changed, 4 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/root-tree.c b/root-tree.c
>>>> index 782472c..39cfef6 100644
>>>> --- a/root-tree.c
>>>> +++ b/root-tree.c
>>>> @@ -182,12 +182,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
>>>> if (ret < 0)
>>>> goto out;
>>>> if (ret) {
>>>> -btrfs_print_leaf(root, path->nodes[0]);
>>>> -printk("failed to del %llu %u %llu\n",
>>>> - (unsigned long long)key->objectid,
>>>> - key->type,
>>>> - (unsigned long long)key->offset);
>>>> -
>>>
>>> I guess Alexander intentionally put in the bad indentation
>>> to remind him to remove this code before submitting the
>>> patch :)
>>>
>>>> + btrfs_print_leaf(root, path->nodes[0]);
>>>> + printk("failed to del %llu %u %llu\n",
>>>> + (unsigned long long)key->objectid, key->type,
>>>> + (unsigned long long)key->offset);
>>>> }
>>
>> When I saw the BUG_ON, I wonder do we still need the above branch statement.
>> It looks just to be helpful for debug - give out some info, right?
>
> Yes. So either we delete it completely or we move the BUG_ON
> into the block as a BUG_ON(1) and add a "Btrfs: "-prefix to the
> printk.
> On the other hand, I just saw this is progs, so I think it can
> just be deleted.
>
>>
>>>> BUG_ON(ret != 0);
>>>> leaf = path->nodes[0];
>>>
>>
>
Patch regenerated. Please check it. Thanks,
>From 2150cb3a3f75416b56a5eb9311fd0d4aa5aaaed5 Mon Sep 17 00:00:00 2001
From: Wang Sheng-Hui <shhuiw@gmail.com>
Date: Thu, 16 Aug 2012 22:23:07 +0800
Subject: [PATCH] btrfs-progs: code cleanup for root-tree.c/btrfs_del_root
Remove the redundant if check on the condition ret > 0.
Leave BUG_ON check here.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
root-tree.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/root-tree.c b/root-tree.c
index 782472c..4578514 100644
--- a/root-tree.c
+++ b/root-tree.c
@@ -181,14 +181,6 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
ret = btrfs_search_slot(trans, root, key, path, -1, 1);
if (ret < 0)
goto out;
- if (ret) {
-btrfs_print_leaf(root, path->nodes[0]);
-printk("failed to del %llu %u %llu\n",
- (unsigned long long)key->objectid,
- key->type,
- (unsigned long long)key->offset);
-
- }
BUG_ON(ret != 0);
leaf = path->nodes[0];
ri = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_root_item);
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-16 14:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-16 13:17 [PATCH] btrfs-progs: trivial code style fix in root-tree.c Wang Sheng-Hui
2012-08-16 13:23 ` Arne Jansen
2012-08-16 13:26 ` Wang Sheng-Hui
2012-08-16 13:30 ` Arne Jansen
2012-08-16 14:25 ` Wang Sheng-Hui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).