btrfs-progs: remove parent_key arg from btrfs_check_* helpers

Now that this is unused by these helpers and only used by the repair
related code we can remove this argument from the main helpers.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2023-04-19 17:13:53 -04:00 committed by David Sterba
parent 90e687d90c
commit b0a4eab561
4 changed files with 10 additions and 21 deletions

View File

@ -307,9 +307,9 @@ enum btrfs_tree_block_status btrfs_check_block_for_repair(struct extent_buffer *
enum btrfs_tree_block_status status; enum btrfs_tree_block_status status;
if (btrfs_is_leaf(eb)) if (btrfs_is_leaf(eb))
status = btrfs_check_leaf(first_key, eb); status = btrfs_check_leaf(eb);
else else
status = btrfs_check_node(first_key, eb); status = btrfs_check_node(eb);
if (status == BTRFS_TREE_BLOCK_CLEAN) if (status == BTRFS_TREE_BLOCK_CLEAN)
return status; return status;

View File

@ -611,8 +611,7 @@ static void generic_err(const struct extent_buffer *buf, int slot,
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
enum btrfs_tree_block_status enum btrfs_tree_block_status btrfs_check_node(struct extent_buffer *node)
btrfs_check_node(struct btrfs_key *parent_key, struct extent_buffer *node)
{ {
struct btrfs_fs_info *fs_info = node->fs_info; struct btrfs_fs_info *fs_info = node->fs_info;
unsigned long nr = btrfs_header_nritems(node); unsigned long nr = btrfs_header_nritems(node);
@ -673,8 +672,7 @@ fail:
return ret; return ret;
} }
enum btrfs_tree_block_status enum btrfs_tree_block_status btrfs_check_leaf(struct extent_buffer *leaf)
btrfs_check_leaf(struct btrfs_key *parent_key, struct extent_buffer *leaf)
{ {
struct btrfs_fs_info *fs_info = leaf->fs_info; struct btrfs_fs_info *fs_info = leaf->fs_info;
/* No valid key type is 0, so all key should be larger than this key */ /* No valid key type is 0, so all key should be larger than this key */
@ -781,21 +779,14 @@ fail:
static int noinline check_block(struct btrfs_fs_info *fs_info, static int noinline check_block(struct btrfs_fs_info *fs_info,
struct btrfs_path *path, int level) struct btrfs_path *path, int level)
{ {
struct btrfs_key key;
struct btrfs_key *parent_key_ptr = NULL;
enum btrfs_tree_block_status ret; enum btrfs_tree_block_status ret;
if (path->skip_check_block) if (path->skip_check_block)
return 0; return 0;
if (path->nodes[level + 1]) {
btrfs_node_key_to_cpu(path->nodes[level + 1], &key,
path->slots[level + 1]);
parent_key_ptr = &key;
}
if (level == 0) if (level == 0)
ret = btrfs_check_leaf(parent_key_ptr, path->nodes[0]); ret = btrfs_check_leaf(path->nodes[0]);
else else
ret = btrfs_check_node(parent_key_ptr, path->nodes[level]); ret = btrfs_check_node(path->nodes[level]);
if (ret == BTRFS_TREE_BLOCK_CLEAN) if (ret == BTRFS_TREE_BLOCK_CLEAN)
return 0; return 0;
return -EIO; return -EIO;

View File

@ -2704,10 +2704,8 @@ int btrfs_convert_one_bg(struct btrfs_trans_handle *trans, u64 bytenr);
int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2); int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2);
int btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path, int btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path,
int level, int slot); int level, int slot);
enum btrfs_tree_block_status enum btrfs_tree_block_status btrfs_check_node(struct extent_buffer *buf);
btrfs_check_node(struct btrfs_key *parent_key, struct extent_buffer *buf); enum btrfs_tree_block_status btrfs_check_leaf(struct extent_buffer *buf);
enum btrfs_tree_block_status
btrfs_check_leaf(struct btrfs_key *parent_key, struct extent_buffer *buf);
void reada_for_search(struct btrfs_fs_info *fs_info, struct btrfs_path *path, void reada_for_search(struct btrfs_fs_info *fs_info, struct btrfs_path *path,
int level, int slot, u64 objectid); int level, int slot, u64 objectid);
struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info, struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,

View File

@ -389,9 +389,9 @@ struct extent_buffer* read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
* btrfs ins dump-tree. * btrfs ins dump-tree.
*/ */
if (btrfs_header_level(eb)) if (btrfs_header_level(eb))
ret = btrfs_check_node(NULL, eb); ret = btrfs_check_node(eb);
else else
ret = btrfs_check_leaf(NULL, eb); ret = btrfs_check_leaf(eb);
if (!ret || candidate_mirror == mirror_num) { if (!ret || candidate_mirror == mirror_num) {
btrfs_set_buffer_uptodate(eb); btrfs_set_buffer_uptodate(eb);
return eb; return eb;