All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: <dsterba@suse.cz>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: move the extent buffer radix tree into the fs_info
Date: Tue, 17 Dec 2013 09:56:07 -0500	[thread overview]
Message-ID: <52B06607.9000108@fb.com> (raw)
In-Reply-To: <20131217010627.GK6498@twin.jikos.cz>


On 12/16/2013 08:06 PM, David Sterba wrote:
> On Mon, Dec 16, 2013 at 01:26:26PM -0500, Josef Bacik wrote:
>> I need to create a fake tree to test qgroups and I don't want to have to setup a
>> fake btree_inode.  The fact is we only use the radix tree for the fs_info, so
>> everybody else who allocates an extent_io_tree is just wasting the space anyway.
>> This patch moves the radix tree and its lock into btrfs_fs_info so there is less
>> stuff I have to fake to do qgroup sanity tests.  Thanks,
> This would make the fs_info::buffer_lock a global hotspot if
> alloc_extent_buffer and release_extent_buffer are called frequently.
>
> But, you can get rid of the buffer_lock completely, because the radix
> tree can be safely protected by rcu_read_lock/_unlock:
>
> * alloc_extent_buffer uses radix_preload that turns off preepmtion by
> itself, so the lock here would be pointless

Except you still need a lock for other inserts.
>
> * release_extent_buffer locks around radix_tree_delete, here a rcu
> locking will be ok as well

No it won't.  RCU just makes sure readers don't get screwed, you still 
need to have real locking around the insertions/deletions, look at 
pagecache, we have mapping->tree_lock for this even though it uses rcu 
for the lookups.  Thanks,

Josef

  parent reply	other threads:[~2013-12-17 14:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 18:26 [PATCH] Btrfs: move the extent buffer radix tree into the fs_info Josef Bacik
2013-12-17  1:06 ` David Sterba
2013-12-17  1:19   ` Chris Mason
2013-12-17 13:56     ` David Sterba
2013-12-17 14:56   ` Josef Bacik [this message]
2013-12-17 15:18     ` David Sterba

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=52B06607.9000108@fb.com \
    --to=jbacik@fb.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.