From: Liu Bo <bo.li.liu@oracle.com>
To: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: optimize to remove unnecessary removal with ulist reallocation
Date: Mon, 13 Jan 2014 10:31:10 +0800 [thread overview]
Message-ID: <20140113023109.GA26294@localhost.localdomain> (raw)
In-Reply-To: <1389360346-23842-1-git-send-email-wangsl.fnst@cn.fujitsu.com>
On Fri, Jan 10, 2014 at 09:25:46PM +0800, Wang Shilong wrote:
> Here we are not going to free memory, no need to remove every node
> one by one, just init root node here is ok.
Looks fine, but we need to make sure that it passes the regression test since you're
working on an old bug.
-liubo
>
> Cc: Liu Bo <bo.li.liu@oracle.com>
> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
> ---
> fs/btrfs/ulist.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/ulist.c b/fs/btrfs/ulist.c
> index b0a523b2..35f5de9 100644
> --- a/fs/btrfs/ulist.c
> +++ b/fs/btrfs/ulist.c
> @@ -207,9 +207,6 @@ int ulist_add_merge(struct ulist *ulist, u64 val, u64 aux,
> void *old = NULL;
> int i;
>
> - for (i = 0; i < ulist->nnodes; i++)
> - rb_erase(&ulist->nodes[i].rb_node, &ulist->root);
> -
> /*
> * if nodes_alloced == ULIST_SIZE no memory has been allocated
> * yet, so pass NULL to krealloc
> @@ -234,6 +231,7 @@ int ulist_add_merge(struct ulist *ulist, u64 val, u64 aux,
> * pointers, so we have to do it ourselves. Otherwise we may
> * be bitten by crashes.
> */
> + ulist->root = RB_ROOT;
> for (i = 0; i < ulist->nnodes; i++) {
> ret = ulist_rbtree_insert(ulist, &ulist->nodes[i]);
> if (ret < 0)
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2014-01-13 2:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 13:25 [PATCH] Btrfs: optimize to remove unnecessary removal with ulist reallocation Wang Shilong
2014-01-13 2:31 ` Liu Bo [this message]
2014-01-24 9:16 ` 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=20140113023109.GA26294@localhost.localdomain \
--to=bo.li.liu@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--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