提交 d30a668f 编写于 作者: D David Sterba

btrfs: get fs_info from trans in push_node_left

We can read fs_info from the transaction and can drop it from the
parameters.
Signed-off-by: NDavid Sterba <dsterba@suse.com>
上级 fe041534
...@@ -21,7 +21,6 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root *root, ...@@ -21,7 +21,6 @@ static int split_leaf(struct btrfs_trans_handle *trans, struct btrfs_root *root,
const struct btrfs_key *ins_key, struct btrfs_path *path, const struct btrfs_key *ins_key, struct btrfs_path *path,
int data_size, int extend); int data_size, int extend);
static int push_node_left(struct btrfs_trans_handle *trans, static int push_node_left(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info,
struct extent_buffer *dst, struct extent_buffer *dst,
struct extent_buffer *src, int empty); struct extent_buffer *src, int empty);
static int balance_node_right(struct btrfs_trans_handle *trans, static int balance_node_right(struct btrfs_trans_handle *trans,
...@@ -1935,7 +1934,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, ...@@ -1935,7 +1934,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
/* first, try to make some room in the middle buffer */ /* first, try to make some room in the middle buffer */
if (left) { if (left) {
orig_slot += btrfs_header_nritems(left); orig_slot += btrfs_header_nritems(left);
wret = push_node_left(trans, fs_info, left, mid, 1); wret = push_node_left(trans, left, mid, 1);
if (wret < 0) if (wret < 0)
ret = wret; ret = wret;
} }
...@@ -1944,7 +1943,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, ...@@ -1944,7 +1943,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
* then try to empty the right most buffer into the middle * then try to empty the right most buffer into the middle
*/ */
if (right) { if (right) {
wret = push_node_left(trans, fs_info, mid, right, 1); wret = push_node_left(trans, mid, right, 1);
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) {
...@@ -1986,7 +1985,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans, ...@@ -1986,7 +1985,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
goto enospc; goto enospc;
} }
if (wret == 1) { if (wret == 1) {
wret = push_node_left(trans, fs_info, left, mid, 1); wret = push_node_left(trans, left, mid, 1);
if (wret < 0) if (wret < 0)
ret = wret; ret = wret;
} }
...@@ -2097,8 +2096,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans, ...@@ -2097,8 +2096,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
if (ret) if (ret)
wret = 1; wret = 1;
else { else {
wret = push_node_left(trans, fs_info, wret = push_node_left(trans, left, mid, 0);
left, mid, 0);
} }
} }
if (wret < 0) if (wret < 0)
...@@ -3211,10 +3209,10 @@ void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info, ...@@ -3211,10 +3209,10 @@ void btrfs_set_item_key_safe(struct btrfs_fs_info *fs_info,
* error, and > 0 if there was no room in the left hand block. * error, and > 0 if there was no room in the left hand block.
*/ */
static int push_node_left(struct btrfs_trans_handle *trans, static int push_node_left(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info,
struct extent_buffer *dst, struct extent_buffer *dst,
struct extent_buffer *src, int empty) struct extent_buffer *src, int empty)
{ {
struct btrfs_fs_info *fs_info = trans->fs_info;
int push_items = 0; int push_items = 0;
int src_nritems; int src_nritems;
int dst_nritems; int dst_nritems;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册