btrfs-progs: Use @fs_info to replace @root for btrfs_check_leaf/node()

Signed-off-by: Qu Wenruo <wqu@suse.com>
master
Qu Wenruo 2019-03-07 19:31:30 +08:00
parent 83aeb251f7
commit db51d8d8f6
4 changed files with 30 additions and 30 deletions

View File

@ -1790,9 +1790,9 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
}
if (btrfs_is_leaf(next))
status = btrfs_check_leaf(root, NULL, next);
status = btrfs_check_leaf(fs_info, NULL, next);
else
status = btrfs_check_node(root, NULL, next);
status = btrfs_check_node(fs_info, NULL, next);
if (status != BTRFS_TREE_BLOCK_CLEAN) {
free_extent_buffer(next);
err = -EIO;
@ -3464,9 +3464,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(root, NULL, root->node);
status = btrfs_check_leaf(root->fs_info, NULL, root->node);
else
status = btrfs_check_node(root, NULL, root->node);
status = btrfs_check_node(root->fs_info, NULL, root->node);
if (status != BTRFS_TREE_BLOCK_CLEAN)
return -EIO;
@ -4304,9 +4304,9 @@ static int check_block(struct btrfs_root *root,
rec->info_level = level;
if (btrfs_is_leaf(buf))
status = btrfs_check_leaf(root, &rec->parent_key, buf);
status = btrfs_check_leaf(root->fs_info, &rec->parent_key, buf);
else
status = btrfs_check_node(root, &rec->parent_key, buf);
status = btrfs_check_node(root->fs_info, &rec->parent_key, buf);
if (status != BTRFS_TREE_BLOCK_CLEAN) {
if (repair)

View File

@ -4674,7 +4674,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(root, NULL, cur);
ret = btrfs_check_leaf(fs_info, NULL, cur);
if (ret != BTRFS_TREE_BLOCK_CLEAN) {
err |= -EIO;
break;
@ -4691,7 +4691,7 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
break;
}
if (check || !check_all) {
ret = btrfs_check_node(root, NULL, cur);
ret = btrfs_check_node(fs_info, NULL, cur);
if (ret != BTRFS_TREE_BLOCK_CLEAN) {
err |= -EIO;
break;
@ -4739,9 +4739,9 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
break;
if (btrfs_is_leaf(next))
status = btrfs_check_leaf(root, NULL, next);
status = btrfs_check_leaf(fs_info, NULL, next);
else
status = btrfs_check_node(root, NULL, next);
status = btrfs_check_node(fs_info, NULL, next);
if (status != BTRFS_TREE_BLOCK_CLEAN) {
free_extent_buffer(next);
err |= -EIO;

32
ctree.c
View File

@ -434,8 +434,8 @@ static inline unsigned int leaf_data_end(const struct btrfs_fs_info *fs_info,
}
enum btrfs_tree_block_status
btrfs_check_node(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
struct extent_buffer *buf)
btrfs_check_node(struct btrfs_fs_info *fs_info,
struct btrfs_disk_key *parent_key, struct extent_buffer *buf)
{
int i;
struct btrfs_key cpukey;
@ -443,7 +443,7 @@ btrfs_check_node(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
u32 nritems = btrfs_header_nritems(buf);
enum btrfs_tree_block_status ret = BTRFS_TREE_BLOCK_INVALID_NRITEMS;
if (nritems == 0 || nritems > BTRFS_NODEPTRS_PER_BLOCK(root->fs_info))
if (nritems == 0 || nritems > BTRFS_NODEPTRS_PER_BLOCK(fs_info))
goto fail;
ret = BTRFS_TREE_BLOCK_INVALID_PARENT_KEY;
@ -466,7 +466,7 @@ fail:
btrfs_disk_key_to_cpu(&cpukey, parent_key);
else
btrfs_node_key_to_cpu(buf, &cpukey, 0);
btrfs_add_corrupt_extent_record(root->fs_info, &cpukey,
btrfs_add_corrupt_extent_record(fs_info, &cpukey,
buf->start, buf->len,
btrfs_header_level(buf));
}
@ -474,8 +474,8 @@ fail:
}
enum btrfs_tree_block_status
btrfs_check_leaf(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
struct extent_buffer *buf)
btrfs_check_leaf(struct btrfs_fs_info *fs_info,
struct btrfs_disk_key *parent_key, struct extent_buffer *buf)
{
int i;
struct btrfs_key cpukey;
@ -531,18 +531,18 @@ btrfs_check_leaf(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
goto fail;
}
if (i == 0 && btrfs_item_end_nr(buf, i) !=
BTRFS_LEAF_DATA_SIZE(root->fs_info)) {
BTRFS_LEAF_DATA_SIZE(fs_info)) {
ret = BTRFS_TREE_BLOCK_INVALID_OFFSETS;
fprintf(stderr, "bad item end %u wanted %u\n",
btrfs_item_end_nr(buf, i),
(unsigned)BTRFS_LEAF_DATA_SIZE(root->fs_info));
(unsigned)BTRFS_LEAF_DATA_SIZE(fs_info));
goto fail;
}
}
for (i = 0; i < nritems; i++) {
if (btrfs_item_end_nr(buf, i) >
BTRFS_LEAF_DATA_SIZE(root->fs_info)) {
BTRFS_LEAF_DATA_SIZE(fs_info)) {
btrfs_item_key(buf, &key, 0);
btrfs_print_key(&key);
fflush(stdout);
@ -550,7 +550,7 @@ btrfs_check_leaf(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
fprintf(stderr, "slot end outside of leaf %llu > %llu\n",
(unsigned long long)btrfs_item_end_nr(buf, i),
(unsigned long long)BTRFS_LEAF_DATA_SIZE(
root->fs_info));
fs_info));
goto fail;
}
}
@ -563,13 +563,13 @@ fail:
else
btrfs_item_key_to_cpu(buf, &cpukey, 0);
btrfs_add_corrupt_extent_record(root->fs_info, &cpukey,
btrfs_add_corrupt_extent_record(fs_info, &cpukey,
buf->start, buf->len, 0);
}
return ret;
}
static int noinline check_block(struct btrfs_root *root,
static int noinline check_block(struct btrfs_fs_info *fs_info,
struct btrfs_path *path, int level)
{
struct btrfs_disk_key key;
@ -585,9 +585,9 @@ static int noinline check_block(struct btrfs_root *root,
key_ptr = &key;
}
if (level == 0)
ret = btrfs_check_leaf(root, key_ptr, path->nodes[0]);
ret = btrfs_check_leaf(fs_info, key_ptr, path->nodes[0]);
else
ret = btrfs_check_node(root, key_ptr, path->nodes[level]);
ret = btrfs_check_node(fs_info, key_ptr, path->nodes[level]);
if (ret == BTRFS_TREE_BLOCK_CLEAN)
return 0;
return -EIO;
@ -871,7 +871,7 @@ static int balance_level(struct btrfs_trans_handle *trans,
}
}
/* double check we haven't messed things up */
check_block(root, path, level);
check_block(root->fs_info, path, level);
if (orig_ptr !=
btrfs_node_blockptr(path->nodes[level], path->slots[level]))
BUG();
@ -1169,7 +1169,7 @@ again:
WARN_ON(1);
level = btrfs_header_level(b);
p->nodes[level] = b;
ret = check_block(root, p, level);
ret = check_block(fs_info, p, level);
if (ret)
return -1;
ret = bin_search(b, key, level, &slot);

View File

@ -2562,11 +2562,11 @@ 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_root *root, struct btrfs_disk_key *parent_key,
struct extent_buffer *buf);
btrfs_check_node(struct btrfs_fs_info *fs_info,
struct btrfs_disk_key *parent_key, struct extent_buffer *buf);
enum btrfs_tree_block_status
btrfs_check_leaf(struct btrfs_root *root, struct btrfs_disk_key *parent_key,
struct extent_buffer *buf);
btrfs_check_leaf(struct btrfs_fs_info *fs_info,
struct btrfs_disk_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,