From: Arne Jansen <sensille@gmx.net>
To: Wang Shilong <wangshilong1991@gmail.com>
Cc: linux-btrfs@vger.kernel.org, list.btrfs@jan-o-sch.net,
wangsl-fnst@cn.fujitsu.com
Subject: Re: [PATCH] Btrfs: cleanup to remove reduplicate code in iterate_extent_inode()
Date: Sat, 30 Mar 2013 14:44:20 +0100 [thread overview]
Message-ID: <5156EC34.2090805@gmx.net> (raw)
In-Reply-To: <C94A0D89-18E9-447B-A08E-2D0A4E3CAD18@gmail.com>
On 03/30/13 12:55, Wang Shilong wrote:
> <snip>
>
>> On 03/29/13 14:42, Wang Shilong wrote:
>>> From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
>>>
>>> Just remove the unnecessary check and assignment.
>>>
>>> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
>>> ---
>>> fs/btrfs/backref.c | 3 +--
>>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
>>> index 3ca413bb..e102b48 100644
>>> --- a/fs/btrfs/backref.c
>>> +++ b/fs/btrfs/backref.c
>>> @@ -1499,7 +1499,7 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
>>> if (ret)
>>> break;
>>> ULIST_ITER_INIT(&root_uiter);
>>> - while (!ret && (root_node = ulist_next(roots, &root_uiter))) {
>>> + while ((root_node = ulist_next(roots, &root_uiter))) {
>>
>> It doesn't look unnecessary at all to me. ret is set in the loop and
>> only checked in the while condition.
>>
>>> pr_debug("root %llu references leaf %llu, data list "
>>> "%#llx\n", root_node->val, ref_node->val,
>>> (long long)ref_node->aux);
>>> @@ -1510,7 +1510,6 @@ int iterate_extent_inodes(struct btrfs_fs_info *fs_info,
>>> iterate, ctx);
>>> }
>>> ulist_free(roots);
>>> - roots = NULL;
>>
>> roots gets freed again later on. If you don't set it to NULL, it will
>> result in a double free.
>
> Maybe you mean this?
>
> http://marc.info/?l=linux-btrfs&m=136456233929528&w=2
> ulist_free() here is unnecessary and may cause a double free…
> So we don't need to set it to NULL again..
Yeah, I haven't seen your other patch.
>
>
>
>>
>> -Arne
>>
>>> }
>>>
>>> free_leaf_list(refs);
>>>
>>
>
next prev parent reply other threads:[~2013-03-30 13:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-29 13:42 [PATCH] Btrfs: cleanup to remove reduplicate code in iterate_extent_inode() Wang Shilong
2013-03-30 10:08 ` Arne Jansen
2013-03-30 11:47 ` Wang Shilong
2013-03-30 11:55 ` Wang Shilong
2013-03-30 13:44 ` Arne Jansen [this message]
2013-03-31 10:40 ` Wang Shilong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5156EC34.2090805@gmx.net \
--to=sensille@gmx.net \
--cc=linux-btrfs@vger.kernel.org \
--cc=list.btrfs@jan-o-sch.net \
--cc=wangshilong1991@gmail.com \
--cc=wangsl-fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox