btrfs: rename and export read_node_slot
Preparatory work for code that will be moved out of ctree and uses this function. Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
8a953348af
commit
4b231ae474
|
@ -1792,8 +1792,8 @@ static void root_sub_used(struct btrfs_root *root, u32 size)
|
|||
/* given a node and slot number, this reads the blocks it points to. The
|
||||
* extent buffer is returned with a reference taken (but unlocked).
|
||||
*/
|
||||
static noinline struct extent_buffer *read_node_slot(
|
||||
struct extent_buffer *parent, int slot)
|
||||
struct extent_buffer *btrfs_read_node_slot(struct extent_buffer *parent,
|
||||
int slot)
|
||||
{
|
||||
int level = btrfs_header_level(parent);
|
||||
struct extent_buffer *eb;
|
||||
|
@ -1862,7 +1862,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
|
|||
return 0;
|
||||
|
||||
/* promote the child to a root */
|
||||
child = read_node_slot(mid, 0);
|
||||
child = btrfs_read_node_slot(mid, 0);
|
||||
if (IS_ERR(child)) {
|
||||
ret = PTR_ERR(child);
|
||||
btrfs_handle_fs_error(fs_info, ret, NULL);
|
||||
|
@ -1902,7 +1902,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
|
|||
BTRFS_NODEPTRS_PER_BLOCK(fs_info) / 4)
|
||||
return 0;
|
||||
|
||||
left = read_node_slot(parent, pslot - 1);
|
||||
left = btrfs_read_node_slot(parent, pslot - 1);
|
||||
if (IS_ERR(left))
|
||||
left = NULL;
|
||||
|
||||
|
@ -1917,7 +1917,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
|
|||
}
|
||||
}
|
||||
|
||||
right = read_node_slot(parent, pslot + 1);
|
||||
right = btrfs_read_node_slot(parent, pslot + 1);
|
||||
if (IS_ERR(right))
|
||||
right = NULL;
|
||||
|
||||
|
@ -2077,7 +2077,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
|
|||
if (!parent)
|
||||
return 1;
|
||||
|
||||
left = read_node_slot(parent, pslot - 1);
|
||||
left = btrfs_read_node_slot(parent, pslot - 1);
|
||||
if (IS_ERR(left))
|
||||
left = NULL;
|
||||
|
||||
|
@ -2129,7 +2129,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
|
|||
btrfs_tree_unlock(left);
|
||||
free_extent_buffer(left);
|
||||
}
|
||||
right = read_node_slot(parent, pslot + 1);
|
||||
right = btrfs_read_node_slot(parent, pslot + 1);
|
||||
if (IS_ERR(right))
|
||||
right = NULL;
|
||||
|
||||
|
@ -3783,7 +3783,7 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
|
|||
|
||||
btrfs_assert_tree_locked(path->nodes[1]);
|
||||
|
||||
right = read_node_slot(upper, slot + 1);
|
||||
right = btrfs_read_node_slot(upper, slot + 1);
|
||||
/*
|
||||
* slot + 1 is not valid or we fail to read the right node,
|
||||
* no big deal, just return.
|
||||
|
@ -4017,7 +4017,7 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
|
|||
|
||||
btrfs_assert_tree_locked(path->nodes[1]);
|
||||
|
||||
left = read_node_slot(path->nodes[1], slot - 1);
|
||||
left = btrfs_read_node_slot(path->nodes[1], slot - 1);
|
||||
/*
|
||||
* slot - 1 is not valid or we fail to read the left node,
|
||||
* no big deal, just return.
|
||||
|
@ -5224,7 +5224,7 @@ find_next_key:
|
|||
goto out;
|
||||
}
|
||||
btrfs_set_path_blocking(path);
|
||||
cur = read_node_slot(cur, slot);
|
||||
cur = btrfs_read_node_slot(cur, slot);
|
||||
if (IS_ERR(cur)) {
|
||||
ret = PTR_ERR(cur);
|
||||
goto out;
|
||||
|
@ -5251,7 +5251,7 @@ static int tree_move_down(struct btrfs_path *path, int *level)
|
|||
struct extent_buffer *eb;
|
||||
|
||||
BUG_ON(*level == 0);
|
||||
eb = read_node_slot(path->nodes[*level], path->slots[*level]);
|
||||
eb = btrfs_read_node_slot(path->nodes[*level], path->slots[*level]);
|
||||
if (IS_ERR(eb))
|
||||
return PTR_ERR(eb);
|
||||
|
||||
|
|
|
@ -2587,6 +2587,9 @@ int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path,
|
|||
int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
|
||||
struct btrfs_path *path,
|
||||
u64 min_trans);
|
||||
struct extent_buffer *btrfs_read_node_slot(struct extent_buffer *parent,
|
||||
int slot);
|
||||
|
||||
enum btrfs_compare_tree_result {
|
||||
BTRFS_COMPARE_TREE_NEW,
|
||||
BTRFS_COMPARE_TREE_DELETED,
|
||||
|
|
Loading…
Reference in New Issue