btrfs-progs: remove fs_info argument from btrfs_check_* helpers

This can be pulled out of the extent buffer that is passed in, drop the
fs_info argument from the function.

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:51 -04:00 committed by David Sterba
parent bee10e7fc9
commit d36571ed9a
5 changed files with 21 additions and 23 deletions

View File

@ -1921,9 +1921,9 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
}
if (btrfs_is_leaf(next))
status = btrfs_check_leaf(gfs_info, NULL, next);
status = btrfs_check_leaf(NULL, next);
else
status = btrfs_check_node(gfs_info, NULL, next);
status = btrfs_check_node(NULL, next);
if (status != BTRFS_TREE_BLOCK_CLEAN) {
free_extent_buffer(next);
err = -EIO;
@ -3702,9 +3702,9 @@ static int check_fs_root(struct btrfs_root *root,
/* We may not have checked the root block, lets do that now */
if (btrfs_is_leaf(root->node))
status = btrfs_check_leaf(gfs_info, NULL, root->node);
status = btrfs_check_leaf(NULL, root->node);
else
status = btrfs_check_node(gfs_info, NULL, root->node);
status = btrfs_check_node(NULL, root->node);
if (status != BTRFS_TREE_BLOCK_CLEAN)
return -EIO;
@ -4608,9 +4608,9 @@ static int check_block(struct btrfs_root *root,
rec->info_level = level;
if (btrfs_is_leaf(buf))
status = btrfs_check_leaf(gfs_info, &rec->parent_key, buf);
status = btrfs_check_leaf(&rec->parent_key, buf);
else
status = btrfs_check_node(gfs_info, &rec->parent_key, buf);
status = btrfs_check_node(&rec->parent_key, buf);
if (status != BTRFS_TREE_BLOCK_CLEAN) {
if (opt_check_repair)

View File

@ -2695,7 +2695,7 @@ static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path)
* we need to bail otherwise we could end up stuck.
*/
if (path->slots[0] == 0 &&
btrfs_check_leaf(gfs_info, NULL, path->nodes[0]))
btrfs_check_leaf(NULL, path->nodes[0]))
ret = -EIO;
if (ret < 0) {
@ -5001,7 +5001,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
if (*level == 0) {
/* skip duplicate check */
if (check || !check_all) {
ret = btrfs_check_leaf(gfs_info, NULL, cur);
ret = btrfs_check_leaf(NULL, cur);
if (ret != BTRFS_TREE_BLOCK_CLEAN) {
err |= -EIO;
break;
@ -5018,7 +5018,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
break;
}
if (check || !check_all) {
ret = btrfs_check_node(gfs_info, NULL, cur);
ret = btrfs_check_node(NULL, cur);
if (ret != BTRFS_TREE_BLOCK_CLEAN) {
err |= -EIO;
break;
@ -5066,9 +5066,9 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
break;
if (btrfs_is_leaf(next))
status = btrfs_check_leaf(gfs_info, NULL, next);
status = btrfs_check_leaf(NULL, next);
else
status = btrfs_check_node(gfs_info, NULL, next);
status = btrfs_check_node(NULL, next);
if (status != BTRFS_TREE_BLOCK_CLEAN) {
free_extent_buffer(next);
err |= -EIO;

View File

@ -612,9 +612,9 @@ static void generic_err(const struct extent_buffer *buf, int slot,
}
enum btrfs_tree_block_status
btrfs_check_node(struct btrfs_fs_info *fs_info,
struct btrfs_key *parent_key, 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;
unsigned long nr = btrfs_header_nritems(node);
struct btrfs_key key, next_key;
int slot;
@ -683,9 +683,9 @@ fail:
}
enum btrfs_tree_block_status
btrfs_check_leaf(struct btrfs_fs_info *fs_info,
struct btrfs_key *parent_key, 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;
/* No valid key type is 0, so all key should be larger than this key */
struct btrfs_key prev_key = {0, 0, 0};
struct btrfs_key key;
@ -811,9 +811,9 @@ static int noinline check_block(struct btrfs_fs_info *fs_info,
parent_key_ptr = &key;
}
if (level == 0)
ret = btrfs_check_leaf(fs_info, parent_key_ptr, path->nodes[0]);
ret = btrfs_check_leaf(parent_key_ptr, path->nodes[0]);
else
ret = btrfs_check_node(fs_info, parent_key_ptr, path->nodes[level]);
ret = btrfs_check_node(parent_key_ptr, path->nodes[level]);
if (ret == BTRFS_TREE_BLOCK_CLEAN)
return 0;
return -EIO;

View File

@ -2705,11 +2705,9 @@ 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 level, int slot);
enum btrfs_tree_block_status
btrfs_check_node(struct btrfs_fs_info *fs_info,
struct btrfs_key *parent_key, 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 btrfs_fs_info *fs_info,
struct btrfs_key *parent_key, struct extent_buffer *buf);
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,
int level, int slot, u64 objectid);
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.
*/
if (btrfs_header_level(eb))
ret = btrfs_check_node(fs_info, NULL, eb);
ret = btrfs_check_node(NULL, eb);
else
ret = btrfs_check_leaf(fs_info, NULL, eb);
ret = btrfs_check_leaf(NULL, eb);
if (!ret || candidate_mirror == mirror_num) {
btrfs_set_buffer_uptodate(eb);
return eb;