linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Chris Mason <chris.mason@oracle.com>
Cc: Linux Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [RFC PATCH 4/4] btrfs: implement delayed dir index insertion and deletion
Date: Mon, 06 Dec 2010 15:25:03 +0800	[thread overview]
Message-ID: <4CFC8FCF.5090807@cn.fujitsu.com> (raw)
In-Reply-To: <1291307496-sup-6170@think>

On thu, 02 Dec 2010 11:33:40 -0500, Chris Mason wrote:
> Excerpts from Miao Xie's message of 2010-12-01 03:09:35 -0500:
>> Compare with Ext3/4, the performance of file creation and deletion on btrfs
>> is very poor. the reason is that btrfs must do a lot of b+ tree insertions,
>> such as inode item, directory name item, directory name index and so on.
>>
>> If we can do some delayed b+ tree insertion or deletion, we can improve the
>> performance, so we made this patch which implemented delayed directory name
>> index insertion and deletion.
>
> Many thanks for working on this.  It's a difficult problem and these
> patches look very clean.
>
> I think you can get more improvement if you also do this delayed scheme
> for the inode items themselves.

I think I can try to do it later.

> The hard part of these delayed implementations is always the throttling,
>
> +    if (delayed_root->count>= root->leafsize / sizeof(*dir_item))
> +        btrfs_run_delayed_dir_index(trans, root, NULL,
> +                        BTRFS_DELAYED_INSERT_ITEM, 0);
> +
>
> Have you experimented with other values here?

Yes, I have tried to set it to other values(such as 40, 100), or remove this check.
Though the performance becomes better as the number increases, the reserved space
that fs needs become larger, if the fs space is not enough, btrfs will call
shrink_delalloc(), the performance drops rapidly.

Maybe we can use a background work thread to do b+ tree insertion and deletion,
and implement it just like dirty page write back mechanism.

> I need to take a hard look at the locking and do some benchmarking on
> larger machines.  I'm a little worried about increased lock contention,
> but I think we can get around it by breaking up the rbtrees a little
> later on if we need to.

Yes, we can create rb-tree for every directory.

Thanks
Miao

      reply	other threads:[~2010-12-06  7:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-01  8:09 [RFC PATCH 4/4] btrfs: implement delayed dir index insertion and deletion Miao Xie
2010-12-02 16:33 ` Chris Mason
2010-12-06  7:25   ` Miao Xie [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=4CFC8FCF.5090807@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=chris.mason@oracle.com \
    --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 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).