Commit 2066bbfc authored by Filipe Manana's avatar Filipe Manana Committed by David Sterba

btrfs: locking: rename __btrfs_tree_lock() and __btrfs_tree_read_lock()

The __btrfs_tree_lock() and __btrfs_tree_read_lock() are using a naming
with a double underscore prefix, which is specially not proper for
exported functions. Remove the double underscore prefix from their name
and add the "_nested" suffix.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent f40ca9cb
...@@ -1003,7 +1003,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, ...@@ -1003,7 +1003,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
goto out; goto out;
} }
__btrfs_tree_lock(left, BTRFS_NESTING_LEFT); btrfs_tree_lock_nested(left, BTRFS_NESTING_LEFT);
wret = btrfs_cow_block(trans, root, left, wret = btrfs_cow_block(trans, root, left,
parent, pslot - 1, &left, parent, pslot - 1, &left,
BTRFS_NESTING_LEFT_COW); BTRFS_NESTING_LEFT_COW);
...@@ -1021,7 +1021,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, ...@@ -1021,7 +1021,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
goto out; goto out;
} }
__btrfs_tree_lock(right, BTRFS_NESTING_RIGHT); btrfs_tree_lock_nested(right, BTRFS_NESTING_RIGHT);
wret = btrfs_cow_block(trans, root, right, wret = btrfs_cow_block(trans, root, right,
parent, pslot + 1, &right, parent, pslot + 1, &right,
BTRFS_NESTING_RIGHT_COW); BTRFS_NESTING_RIGHT_COW);
...@@ -1205,7 +1205,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans, ...@@ -1205,7 +1205,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
if (IS_ERR(left)) if (IS_ERR(left))
return PTR_ERR(left); return PTR_ERR(left);
__btrfs_tree_lock(left, BTRFS_NESTING_LEFT); btrfs_tree_lock_nested(left, BTRFS_NESTING_LEFT);
left_nr = btrfs_header_nritems(left); left_nr = btrfs_header_nritems(left);
if (left_nr >= BTRFS_NODEPTRS_PER_BLOCK(fs_info) - 1) { if (left_nr >= BTRFS_NODEPTRS_PER_BLOCK(fs_info) - 1) {
...@@ -1265,7 +1265,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans, ...@@ -1265,7 +1265,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
if (IS_ERR(right)) if (IS_ERR(right))
return PTR_ERR(right); return PTR_ERR(right);
__btrfs_tree_lock(right, BTRFS_NESTING_RIGHT); btrfs_tree_lock_nested(right, BTRFS_NESTING_RIGHT);
right_nr = btrfs_header_nritems(right); right_nr = btrfs_header_nritems(right);
if (right_nr >= BTRFS_NODEPTRS_PER_BLOCK(fs_info) - 1) { if (right_nr >= BTRFS_NODEPTRS_PER_BLOCK(fs_info) - 1) {
...@@ -3267,7 +3267,7 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -3267,7 +3267,7 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
if (IS_ERR(right)) if (IS_ERR(right))
return PTR_ERR(right); return PTR_ERR(right);
__btrfs_tree_lock(right, BTRFS_NESTING_RIGHT); btrfs_tree_lock_nested(right, BTRFS_NESTING_RIGHT);
free_space = btrfs_leaf_free_space(right); free_space = btrfs_leaf_free_space(right);
if (free_space < data_size) if (free_space < data_size)
...@@ -3483,7 +3483,7 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root ...@@ -3483,7 +3483,7 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
if (IS_ERR(left)) if (IS_ERR(left))
return PTR_ERR(left); return PTR_ERR(left);
__btrfs_tree_lock(left, BTRFS_NESTING_LEFT); btrfs_tree_lock_nested(left, BTRFS_NESTING_LEFT);
free_space = btrfs_leaf_free_space(left); free_space = btrfs_leaf_free_space(left);
if (free_space < data_size) { if (free_space < data_size) {
......
...@@ -5101,7 +5101,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -5101,7 +5101,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
*/ */
btrfs_set_buffer_lockdep_class(lockdep_owner, buf, level); btrfs_set_buffer_lockdep_class(lockdep_owner, buf, level);
__btrfs_tree_lock(buf, nest); btrfs_tree_lock_nested(buf, nest);
btrfs_clear_buffer_dirty(trans, buf); btrfs_clear_buffer_dirty(trans, buf);
clear_bit(EXTENT_BUFFER_STALE, &buf->bflags); clear_bit(EXTENT_BUFFER_STALE, &buf->bflags);
clear_bit(EXTENT_BUFFER_ZONED_ZEROOUT, &buf->bflags); clear_bit(EXTENT_BUFFER_ZONED_ZEROOUT, &buf->bflags);
......
...@@ -129,14 +129,14 @@ static void btrfs_set_eb_lock_owner(struct extent_buffer *eb, pid_t owner) { } ...@@ -129,14 +129,14 @@ static void btrfs_set_eb_lock_owner(struct extent_buffer *eb, pid_t owner) { }
*/ */
/* /*
* __btrfs_tree_read_lock - lock extent buffer for read * btrfs_tree_read_lock_nested - lock extent buffer for read
* @eb: the eb to be locked * @eb: the eb to be locked
* @nest: the nesting level to be used for lockdep * @nest: the nesting level to be used for lockdep
* *
* This takes the read lock on the extent buffer, using the specified nesting * This takes the read lock on the extent buffer, using the specified nesting
* level for lockdep purposes. * level for lockdep purposes.
*/ */
void __btrfs_tree_read_lock(struct extent_buffer *eb, enum btrfs_lock_nesting nest) void btrfs_tree_read_lock_nested(struct extent_buffer *eb, enum btrfs_lock_nesting nest)
{ {
u64 start_ns = 0; u64 start_ns = 0;
...@@ -193,7 +193,7 @@ void btrfs_tree_read_unlock(struct extent_buffer *eb) ...@@ -193,7 +193,7 @@ void btrfs_tree_read_unlock(struct extent_buffer *eb)
* *
* Returns with the eb->lock write locked. * Returns with the eb->lock write locked.
*/ */
void __btrfs_tree_lock(struct extent_buffer *eb, enum btrfs_lock_nesting nest) void btrfs_tree_lock_nested(struct extent_buffer *eb, enum btrfs_lock_nesting nest)
__acquires(&eb->lock) __acquires(&eb->lock)
{ {
u64 start_ns = 0; u64 start_ns = 0;
......
...@@ -163,20 +163,20 @@ enum btrfs_lockdep_trans_states { ...@@ -163,20 +163,20 @@ enum btrfs_lockdep_trans_states {
static_assert(BTRFS_NESTING_MAX <= MAX_LOCKDEP_SUBCLASSES, static_assert(BTRFS_NESTING_MAX <= MAX_LOCKDEP_SUBCLASSES,
"too many lock subclasses defined"); "too many lock subclasses defined");
void __btrfs_tree_lock(struct extent_buffer *eb, enum btrfs_lock_nesting nest); void btrfs_tree_lock_nested(struct extent_buffer *eb, enum btrfs_lock_nesting nest);
static inline void btrfs_tree_lock(struct extent_buffer *eb) static inline void btrfs_tree_lock(struct extent_buffer *eb)
{ {
__btrfs_tree_lock(eb, BTRFS_NESTING_NORMAL); btrfs_tree_lock_nested(eb, BTRFS_NESTING_NORMAL);
} }
void btrfs_tree_unlock(struct extent_buffer *eb); void btrfs_tree_unlock(struct extent_buffer *eb);
void __btrfs_tree_read_lock(struct extent_buffer *eb, enum btrfs_lock_nesting nest); void btrfs_tree_read_lock_nested(struct extent_buffer *eb, enum btrfs_lock_nesting nest);
static inline void btrfs_tree_read_lock(struct extent_buffer *eb) static inline void btrfs_tree_read_lock(struct extent_buffer *eb)
{ {
__btrfs_tree_read_lock(eb, BTRFS_NESTING_NORMAL); btrfs_tree_read_lock_nested(eb, BTRFS_NESTING_NORMAL);
} }
void btrfs_tree_read_unlock(struct extent_buffer *eb); void btrfs_tree_read_unlock(struct extent_buffer *eb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment