btrfs: rename and export read_node_slot
authorDavid Sterba <dsterba@suse.com>
Wed, 21 Aug 2019 17:16:27 +0000 (19:16 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:15 +0000 (14:59 +0200)
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>
fs/btrfs/ctree.c
fs/btrfs/ctree.h

index a2f3cd7a619cc2c563a5d45ee98964b95e284b5c..3b585f3e4d11478a36afe1c0bea339a8b6826bbc 100644 (file)
@@ -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);
 
index 07c08831d6e7347aaa03a4978e5b8f7adfd1520a..dc465df47b32526d0af9ebb04e32763492cabf10 100644 (file)
@@ -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,