All of lore.kernel.org
 help / color / mirror / Atom feed
From: luke <lufq.fnst@cn.fujitsu.com>
To: <dsterba@suse.cz>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs: fix check_shared for fiemap ioctl
Date: Wed, 1 Jun 2016 13:43:37 +0800	[thread overview]
Message-ID: <6b57e774-27f5-d9a7-8bf0-d83b8da6f209@cn.fujitsu.com> (raw)
In-Reply-To: <20160531162325.GJ29147@suse.cz>



At 06/01/2016 12:23 AM, David Sterba wrote:
> On Tue, May 31, 2016 at 03:27:42PM +0800, luke wrote:
>>>> +static void ref_root_fini(struct ref_root *ref_tree)
>>>> +{
>>>> +	struct ref_node *node;
>>>> +	struct rb_node *next;
>>>> +
>>>> +	while ((next = rb_first(&ref_tree->rb_root)) != NULL) {
>>>> +		node = rb_entry(next, struct ref_node, rb_node);
>>>> +		rb_erase(next, &ref_tree->rb_root);
>>>> +		kfree(node);
>>> This could be slow as rb_erase has to do the rb-tree rotations. Can we
>>> do a post-order traversal and just free the nodes?
>> Excuse me, this seems to be standard way to release the rb-tree. For
>> example,  "btrfs_free_block_groups" this function is the same way. So
>> should i refactor this function?
> So for first version it's ok to keep it the simple way, but refactoring
> to the post-order traversal should help performance. And as there are
> more places it would be better to do it separately.
>
>
Yes, you're right. I have updated this patch to fix other problems. And, 
I'll refactor this function with another patch soon.

Thanks,
Lu



      parent reply	other threads:[~2016-06-01  5:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16  3:23 [PATCH] btrfs: fix check_shared for fiemap ioctl Lu Fengqi
2016-05-24  3:42 ` luke
2016-05-27  1:39 ` Qu Wenruo
2016-05-30 15:15   ` David Sterba
2016-05-31  0:38     ` Qu Wenruo
2016-05-30 15:25 ` David Sterba
     [not found]   ` <f7e6d563-9964-5427-d9ad-cf7db858ad24@cn.fujitsu.com>
     [not found]     ` <20160531161555.GI29147@suse.cz>
2016-06-01  1:23       ` luke
2016-06-01 15:09         ` David Sterba
     [not found]   ` <b3c38efb-ddb6-d2b8-34e6-558b1c44065a@cn.fujitsu.com>
     [not found]     ` <20160531162325.GJ29147@suse.cz>
2016-06-01  5:43       ` luke [this message]

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=6b57e774-27f5-d9a7-8bf0-d83b8da6f209@cn.fujitsu.com \
    --to=lufq.fnst@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /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 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.