btrfs: merge back btrfs_read_lock_root_node helpers
We no longer have recursive locking and there's no need for separate helpers that allowed the transition to rwsem with minimal code changes. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
4048daedb9
commit
1bb9659841
@ -2533,7 +2533,7 @@ static struct extent_buffer *btrfs_search_slot_get_root(struct btrfs_root *root,
|
|||||||
* We don't know the level of the root node until we actually
|
* We don't know the level of the root node until we actually
|
||||||
* have it read locked
|
* have it read locked
|
||||||
*/
|
*/
|
||||||
b = __btrfs_read_lock_root_node(root, 0);
|
b = btrfs_read_lock_root_node(root);
|
||||||
level = btrfs_header_level(b);
|
level = btrfs_header_level(b);
|
||||||
if (level > write_lock_level)
|
if (level > write_lock_level)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -184,14 +184,13 @@ struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root)
|
|||||||
*
|
*
|
||||||
* Return: root extent buffer with read lock held
|
* Return: root extent buffer with read lock held
|
||||||
*/
|
*/
|
||||||
struct extent_buffer *__btrfs_read_lock_root_node(struct btrfs_root *root,
|
struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root)
|
||||||
bool recurse)
|
|
||||||
{
|
{
|
||||||
struct extent_buffer *eb;
|
struct extent_buffer *eb;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
eb = btrfs_root_node(root);
|
eb = btrfs_root_node(root);
|
||||||
__btrfs_tree_read_lock(eb, BTRFS_NESTING_NORMAL, recurse);
|
btrfs_tree_read_lock(eb);
|
||||||
if (eb == root->node)
|
if (eb == root->node)
|
||||||
break;
|
break;
|
||||||
btrfs_tree_read_unlock(eb);
|
btrfs_tree_read_unlock(eb);
|
||||||
|
@ -94,13 +94,7 @@ void btrfs_tree_read_unlock(struct extent_buffer *eb);
|
|||||||
int btrfs_try_tree_read_lock(struct extent_buffer *eb);
|
int btrfs_try_tree_read_lock(struct extent_buffer *eb);
|
||||||
int btrfs_try_tree_write_lock(struct extent_buffer *eb);
|
int btrfs_try_tree_write_lock(struct extent_buffer *eb);
|
||||||
struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
|
struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
|
||||||
struct extent_buffer *__btrfs_read_lock_root_node(struct btrfs_root *root,
|
struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root);
|
||||||
bool recurse);
|
|
||||||
|
|
||||||
static inline struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root)
|
|
||||||
{
|
|
||||||
return __btrfs_read_lock_root_node(root, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_BTRFS_DEBUG
|
#ifdef CONFIG_BTRFS_DEBUG
|
||||||
static inline void btrfs_assert_tree_locked(struct extent_buffer *eb) {
|
static inline void btrfs_assert_tree_locked(struct extent_buffer *eb) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user