Commit 6a884d7d authored by David Sterba's avatar David Sterba

btrfs: get fs_info from eb in clean_tree_block

We can read fs_info from extent buffer and can drop it from the
parameters.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent ed874f0d
...@@ -970,7 +970,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans, ...@@ -970,7 +970,7 @@ static noinline int update_ref_for_cow(struct btrfs_trans_handle *trans,
if (ret) if (ret)
return ret; return ret;
} }
clean_tree_block(fs_info, buf); btrfs_clean_tree_block(buf);
*last_ref = 1; *last_ref = 1;
} }
return 0; return 0;
...@@ -1888,7 +1888,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, ...@@ -1888,7 +1888,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
path->locks[level] = 0; path->locks[level] = 0;
path->nodes[level] = NULL; path->nodes[level] = NULL;
clean_tree_block(fs_info, mid); btrfs_clean_tree_block(mid);
btrfs_tree_unlock(mid); btrfs_tree_unlock(mid);
/* once for the path */ /* once for the path */
free_extent_buffer(mid); free_extent_buffer(mid);
...@@ -1949,7 +1949,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, ...@@ -1949,7 +1949,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
if (wret < 0 && wret != -ENOSPC) if (wret < 0 && wret != -ENOSPC)
ret = wret; ret = wret;
if (btrfs_header_nritems(right) == 0) { if (btrfs_header_nritems(right) == 0) {
clean_tree_block(fs_info, right); btrfs_clean_tree_block(right);
btrfs_tree_unlock(right); btrfs_tree_unlock(right);
del_ptr(root, path, level + 1, pslot + 1); del_ptr(root, path, level + 1, pslot + 1);
root_sub_used(root, right->len); root_sub_used(root, right->len);
...@@ -1994,7 +1994,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, ...@@ -1994,7 +1994,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
BUG_ON(wret == 1); BUG_ON(wret == 1);
} }
if (btrfs_header_nritems(mid) == 0) { if (btrfs_header_nritems(mid) == 0) {
clean_tree_block(fs_info, mid); btrfs_clean_tree_block(mid);
btrfs_tree_unlock(mid); btrfs_tree_unlock(mid);
del_ptr(root, path, level + 1, pslot); del_ptr(root, path, level + 1, pslot);
root_sub_used(root, mid->len); root_sub_used(root, mid->len);
...@@ -3704,7 +3704,7 @@ static noinline int __push_leaf_right(struct btrfs_fs_info *fs_info, ...@@ -3704,7 +3704,7 @@ static noinline int __push_leaf_right(struct btrfs_fs_info *fs_info,
if (left_nritems) if (left_nritems)
btrfs_mark_buffer_dirty(left); btrfs_mark_buffer_dirty(left);
else else
clean_tree_block(fs_info, left); btrfs_clean_tree_block(left);
btrfs_mark_buffer_dirty(right); btrfs_mark_buffer_dirty(right);
...@@ -3716,7 +3716,7 @@ static noinline int __push_leaf_right(struct btrfs_fs_info *fs_info, ...@@ -3716,7 +3716,7 @@ static noinline int __push_leaf_right(struct btrfs_fs_info *fs_info,
if (path->slots[0] >= left_nritems) { if (path->slots[0] >= left_nritems) {
path->slots[0] -= left_nritems; path->slots[0] -= left_nritems;
if (btrfs_header_nritems(path->nodes[0]) == 0) if (btrfs_header_nritems(path->nodes[0]) == 0)
clean_tree_block(fs_info, path->nodes[0]); btrfs_clean_tree_block(path->nodes[0]);
btrfs_tree_unlock(path->nodes[0]); btrfs_tree_unlock(path->nodes[0]);
free_extent_buffer(path->nodes[0]); free_extent_buffer(path->nodes[0]);
path->nodes[0] = right; path->nodes[0] = right;
...@@ -3944,7 +3944,7 @@ static noinline int __push_leaf_left(struct btrfs_fs_info *fs_info, ...@@ -3944,7 +3944,7 @@ static noinline int __push_leaf_left(struct btrfs_fs_info *fs_info,
if (right_nritems) if (right_nritems)
btrfs_mark_buffer_dirty(right); btrfs_mark_buffer_dirty(right);
else else
clean_tree_block(fs_info, right); btrfs_clean_tree_block(right);
btrfs_item_key(right, &disk_key, 0); btrfs_item_key(right, &disk_key, 0);
fixup_low_keys(path, &disk_key, 1); fixup_low_keys(path, &disk_key, 1);
...@@ -5005,7 +5005,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -5005,7 +5005,7 @@ int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
btrfs_set_header_level(leaf, 0); btrfs_set_header_level(leaf, 0);
} else { } else {
btrfs_set_path_blocking(path); btrfs_set_path_blocking(path);
clean_tree_block(fs_info, leaf); btrfs_clean_tree_block(leaf);
btrfs_del_leaf(trans, root, path, leaf); btrfs_del_leaf(trans, root, path, leaf);
} }
} else { } else {
......
...@@ -1107,9 +1107,9 @@ struct extent_buffer *read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr, ...@@ -1107,9 +1107,9 @@ struct extent_buffer *read_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr,
} }
void clean_tree_block(struct btrfs_fs_info *fs_info, void btrfs_clean_tree_block(struct extent_buffer *buf)
struct extent_buffer *buf)
{ {
struct btrfs_fs_info *fs_info = buf->fs_info;
if (btrfs_header_generation(buf) == if (btrfs_header_generation(buf) ==
fs_info->running_transaction->transid) { fs_info->running_transaction->transid) {
btrfs_assert_tree_locked(buf); btrfs_assert_tree_locked(buf);
......
...@@ -51,7 +51,7 @@ int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr, ...@@ -51,7 +51,7 @@ int reada_tree_block_flagged(struct btrfs_fs_info *fs_info, u64 bytenr,
struct extent_buffer *btrfs_find_create_tree_block( struct extent_buffer *btrfs_find_create_tree_block(
struct btrfs_fs_info *fs_info, struct btrfs_fs_info *fs_info,
u64 bytenr); u64 bytenr);
void clean_tree_block(struct btrfs_fs_info *fs_info, struct extent_buffer *buf); void btrfs_clean_tree_block(struct extent_buffer *buf);
int open_ctree(struct super_block *sb, int open_ctree(struct super_block *sb,
struct btrfs_fs_devices *fs_devices, struct btrfs_fs_devices *fs_devices,
char *options); char *options);
......
...@@ -8557,7 +8557,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -8557,7 +8557,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level); btrfs_set_buffer_lockdep_class(root->root_key.objectid, buf, level);
btrfs_tree_lock(buf); btrfs_tree_lock(buf);
clean_tree_block(fs_info, buf); btrfs_clean_tree_block(buf);
clear_bit(EXTENT_BUFFER_STALE, &buf->bflags); clear_bit(EXTENT_BUFFER_STALE, &buf->bflags);
btrfs_set_lock_blocking_write(buf); btrfs_set_lock_blocking_write(buf);
...@@ -9252,14 +9252,14 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans, ...@@ -9252,14 +9252,14 @@ static noinline int walk_up_proc(struct btrfs_trans_handle *trans,
ret); ret);
} }
} }
/* make block locked assertion in clean_tree_block happy */ /* make block locked assertion in btrfs_clean_tree_block happy */
if (!path->locks[level] && if (!path->locks[level] &&
btrfs_header_generation(eb) == trans->transid) { btrfs_header_generation(eb) == trans->transid) {
btrfs_tree_lock(eb); btrfs_tree_lock(eb);
btrfs_set_lock_blocking_write(eb); btrfs_set_lock_blocking_write(eb);
path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING; path->locks[level] = BTRFS_WRITE_LOCK_BLOCKING;
} }
clean_tree_block(fs_info, eb); btrfs_clean_tree_block(eb);
} }
if (eb == root->node) { if (eb == root->node) {
......
...@@ -1248,7 +1248,7 @@ int btrfs_clear_free_space_tree(struct btrfs_fs_info *fs_info) ...@@ -1248,7 +1248,7 @@ int btrfs_clear_free_space_tree(struct btrfs_fs_info *fs_info)
list_del(&free_space_root->dirty_list); list_del(&free_space_root->dirty_list);
btrfs_tree_lock(free_space_root->node); btrfs_tree_lock(free_space_root->node);
clean_tree_block(fs_info, free_space_root->node); btrfs_clean_tree_block(free_space_root->node);
btrfs_tree_unlock(free_space_root->node); btrfs_tree_unlock(free_space_root->node);
btrfs_free_tree_block(trans, free_space_root, free_space_root->node, btrfs_free_tree_block(trans, free_space_root, free_space_root->node,
0, 1); 0, 1);
......
...@@ -1101,7 +1101,7 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info) ...@@ -1101,7 +1101,7 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
list_del(&quota_root->dirty_list); list_del(&quota_root->dirty_list);
btrfs_tree_lock(quota_root->node); btrfs_tree_lock(quota_root->node);
clean_tree_block(fs_info, quota_root->node); btrfs_clean_tree_block(quota_root->node);
btrfs_tree_unlock(quota_root->node); btrfs_tree_unlock(quota_root->node);
btrfs_free_tree_block(trans, quota_root, quota_root->node, 0, 1); btrfs_free_tree_block(trans, quota_root, quota_root->node, 0, 1);
......
...@@ -2736,7 +2736,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, ...@@ -2736,7 +2736,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
if (trans) { if (trans) {
btrfs_tree_lock(next); btrfs_tree_lock(next);
btrfs_set_lock_blocking_write(next); btrfs_set_lock_blocking_write(next);
clean_tree_block(fs_info, next); btrfs_clean_tree_block(next);
btrfs_wait_tree_block_writeback(next); btrfs_wait_tree_block_writeback(next);
btrfs_tree_unlock(next); btrfs_tree_unlock(next);
} else { } else {
...@@ -2820,7 +2820,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans, ...@@ -2820,7 +2820,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
if (trans) { if (trans) {
btrfs_tree_lock(next); btrfs_tree_lock(next);
btrfs_set_lock_blocking_write(next); btrfs_set_lock_blocking_write(next);
clean_tree_block(fs_info, next); btrfs_clean_tree_block(next);
btrfs_wait_tree_block_writeback(next); btrfs_wait_tree_block_writeback(next);
btrfs_tree_unlock(next); btrfs_tree_unlock(next);
} else { } else {
...@@ -2902,7 +2902,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, ...@@ -2902,7 +2902,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans,
if (trans) { if (trans) {
btrfs_tree_lock(next); btrfs_tree_lock(next);
btrfs_set_lock_blocking_write(next); btrfs_set_lock_blocking_write(next);
clean_tree_block(fs_info, next); btrfs_clean_tree_block(next);
btrfs_wait_tree_block_writeback(next); btrfs_wait_tree_block_writeback(next);
btrfs_tree_unlock(next); btrfs_tree_unlock(next);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment