Commit 300aa896 authored by David Sterba's avatar David Sterba

btrfs: replace btrfs_set_lock_blocking_rw with appropriate helpers

We can use the right helper where the lock type is a fixed parameter.
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent aa12c027
...@@ -1289,7 +1289,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -1289,7 +1289,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
goto out; goto out;
} }
btrfs_tree_read_lock(eb); btrfs_tree_read_lock(eb);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb);
ret = find_extent_in_eb(eb, bytenr, ret = find_extent_in_eb(eb, bytenr,
*extent_item_pos, &eie, ignore_offset); *extent_item_pos, &eie, ignore_offset);
btrfs_tree_read_unlock_blocking(eb); btrfs_tree_read_unlock_blocking(eb);
...@@ -1650,7 +1650,7 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path, ...@@ -1650,7 +1650,7 @@ char *btrfs_ref_to_path(struct btrfs_root *fs_root, struct btrfs_path *path,
/* make sure we can use eb after releasing the path */ /* make sure we can use eb after releasing the path */
if (eb != eb_in) { if (eb != eb_in) {
if (!path->skip_locking) if (!path->skip_locking)
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb);
path->nodes[0] = NULL; path->nodes[0] = NULL;
path->locks[0] = 0; path->locks[0] = 0;
} }
......
...@@ -1289,7 +1289,7 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path, ...@@ -1289,7 +1289,7 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
return eb; return eb;
btrfs_set_path_blocking(path); btrfs_set_path_blocking(path);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb);
if (tm->op == MOD_LOG_KEY_REMOVE_WHILE_FREEING) { if (tm->op == MOD_LOG_KEY_REMOVE_WHILE_FREEING) {
BUG_ON(tm->slot != 0); BUG_ON(tm->slot != 0);
...@@ -1379,7 +1379,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq) ...@@ -1379,7 +1379,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
free_extent_buffer(eb_root); free_extent_buffer(eb_root);
eb = alloc_dummy_extent_buffer(fs_info, logical); eb = alloc_dummy_extent_buffer(fs_info, logical);
} else { } else {
btrfs_set_lock_blocking_rw(eb_root, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb_root);
eb = btrfs_clone_extent_buffer(eb_root); eb = btrfs_clone_extent_buffer(eb_root);
btrfs_tree_read_unlock_blocking(eb_root); btrfs_tree_read_unlock_blocking(eb_root);
free_extent_buffer(eb_root); free_extent_buffer(eb_root);
......
...@@ -342,7 +342,7 @@ static int verify_parent_transid(struct extent_io_tree *io_tree, ...@@ -342,7 +342,7 @@ static int verify_parent_transid(struct extent_io_tree *io_tree,
if (need_lock) { if (need_lock) {
btrfs_tree_read_lock(eb); btrfs_tree_read_lock(eb);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb);
} }
lock_extent_bits(io_tree, eb->start, eb->start + eb->len - 1, lock_extent_bits(io_tree, eb->start, eb->start + eb->len - 1,
......
...@@ -53,7 +53,7 @@ static inline void btrfs_set_lock_blocking_rw(struct extent_buffer *eb, int rw) ...@@ -53,7 +53,7 @@ static inline void btrfs_set_lock_blocking_rw(struct extent_buffer *eb, int rw)
static inline void btrfs_set_lock_blocking(struct extent_buffer *eb) static inline void btrfs_set_lock_blocking(struct extent_buffer *eb)
{ {
btrfs_set_lock_blocking_rw(eb, BTRFS_WRITE_LOCK); btrfs_set_lock_blocking_write(eb);
} }
#endif #endif
...@@ -1832,7 +1832,7 @@ static int qgroup_trace_extent_swap(struct btrfs_trans_handle* trans, ...@@ -1832,7 +1832,7 @@ static int qgroup_trace_extent_swap(struct btrfs_trans_handle* trans,
src_path->nodes[cur_level] = eb; src_path->nodes[cur_level] = eb;
btrfs_tree_read_lock(eb); btrfs_tree_read_lock(eb);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb);
src_path->locks[cur_level] = BTRFS_READ_LOCK_BLOCKING; src_path->locks[cur_level] = BTRFS_READ_LOCK_BLOCKING;
} }
...@@ -1973,7 +1973,7 @@ static int qgroup_trace_new_subtree_blocks(struct btrfs_trans_handle* trans, ...@@ -1973,7 +1973,7 @@ static int qgroup_trace_new_subtree_blocks(struct btrfs_trans_handle* trans,
dst_path->slots[cur_level] = 0; dst_path->slots[cur_level] = 0;
btrfs_tree_read_lock(eb); btrfs_tree_read_lock(eb);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb);
dst_path->locks[cur_level] = BTRFS_READ_LOCK_BLOCKING; dst_path->locks[cur_level] = BTRFS_READ_LOCK_BLOCKING;
need_cleanup = true; need_cleanup = true;
} }
...@@ -2148,7 +2148,7 @@ int btrfs_qgroup_trace_subtree(struct btrfs_trans_handle *trans, ...@@ -2148,7 +2148,7 @@ int btrfs_qgroup_trace_subtree(struct btrfs_trans_handle *trans,
path->slots[level] = 0; path->slots[level] = 0;
btrfs_tree_read_lock(eb); btrfs_tree_read_lock(eb);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb);
path->locks[level] = BTRFS_READ_LOCK_BLOCKING; path->locks[level] = BTRFS_READ_LOCK_BLOCKING;
ret = btrfs_qgroup_trace_extent(trans, child_bytenr, ret = btrfs_qgroup_trace_extent(trans, child_bytenr,
......
...@@ -583,7 +583,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path, ...@@ -583,7 +583,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
return -EIO; return -EIO;
} }
btrfs_tree_read_lock(eb); btrfs_tree_read_lock(eb);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb);
path->nodes[level-1] = eb; path->nodes[level-1] = eb;
path->slots[level-1] = 0; path->slots[level-1] = 0;
path->locks[level-1] = BTRFS_READ_LOCK_BLOCKING; path->locks[level-1] = BTRFS_READ_LOCK_BLOCKING;
...@@ -987,7 +987,7 @@ int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info) ...@@ -987,7 +987,7 @@ int btrfs_build_ref_tree(struct btrfs_fs_info *fs_info)
return -ENOMEM; return -ENOMEM;
eb = btrfs_read_lock_root_node(fs_info->extent_root); eb = btrfs_read_lock_root_node(fs_info->extent_root);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_set_lock_blocking_read(eb);
level = btrfs_header_level(eb); level = btrfs_header_level(eb);
path->nodes[level] = eb; path->nodes[level] = eb;
path->slots[level] = 0; path->slots[level] = 0;
......
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