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
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to