Skip to content

Commit d73896a

Browse files
fdmananakdave
authored andcommitted
btrfs: stop passing transaction parameter to log tree walk functions
It's unncessary to pass a transaction parameter since struct walk_control already has a member that points to the transaction, so we can make the functions access the structure. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 7f09699 commit d73896a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

fs/btrfs/tree-log.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2782,10 +2782,10 @@ static int clean_log_buffer(struct btrfs_trans_handle *trans,
27822782
return 0;
27832783
}
27842784

2785-
static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
2786-
struct btrfs_path *path, int *level,
2787-
struct walk_control *wc)
2785+
static noinline int walk_down_log_tree(struct btrfs_path *path, int *level,
2786+
struct walk_control *wc)
27882787
{
2788+
struct btrfs_trans_handle *trans = wc->trans;
27892789
struct btrfs_fs_info *fs_info = wc->log->fs_info;
27902790
u64 bytenr;
27912791
u64 ptr_gen;
@@ -2874,9 +2874,8 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
28742874
return 0;
28752875
}
28762876

2877-
static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
2878-
struct btrfs_path *path, int *level,
2879-
struct walk_control *wc)
2877+
static noinline int walk_up_log_tree(struct btrfs_path *path, int *level,
2878+
struct walk_control *wc)
28802879
{
28812880
int i;
28822881
int slot;
@@ -2897,7 +2896,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
28972896
return ret;
28982897

28992898
if (wc->free) {
2900-
ret = clean_log_buffer(trans, path->nodes[*level]);
2899+
ret = clean_log_buffer(wc->trans, path->nodes[*level]);
29012900
if (ret)
29022901
return ret;
29032902
}
@@ -2914,7 +2913,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
29142913
* the tree freeing any blocks that have a ref count of zero after being
29152914
* decremented.
29162915
*/
2917-
static int walk_log_tree(struct btrfs_trans_handle *trans, struct walk_control *wc)
2916+
static int walk_log_tree(struct walk_control *wc)
29182917
{
29192918
struct btrfs_root *log = wc->log;
29202919
int ret = 0;
@@ -2934,15 +2933,15 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, struct walk_control *
29342933
path->slots[level] = 0;
29352934

29362935
while (1) {
2937-
wret = walk_down_log_tree(trans, path, &level, wc);
2936+
wret = walk_down_log_tree(path, &level, wc);
29382937
if (wret > 0)
29392938
break;
29402939
if (wret < 0) {
29412940
ret = wret;
29422941
goto out;
29432942
}
29442943

2945-
wret = walk_up_log_tree(trans, path, &level, wc);
2944+
wret = walk_up_log_tree(path, &level, wc);
29462945
if (wret > 0)
29472946
break;
29482947
if (wret < 0) {
@@ -2959,7 +2958,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, struct walk_control *
29592958
if (ret)
29602959
goto out;
29612960
if (wc->free)
2962-
ret = clean_log_buffer(trans, path->nodes[orig_level]);
2961+
ret = clean_log_buffer(wc->trans, path->nodes[orig_level]);
29632962
}
29642963

29652964
out:
@@ -3427,10 +3426,11 @@ static void free_log_tree(struct btrfs_trans_handle *trans,
34273426
.free = true,
34283427
.process_func = process_one_buffer,
34293428
.log = log,
3429+
.trans = trans,
34303430
};
34313431

34323432
if (log->node) {
3433-
ret = walk_log_tree(trans, &wc);
3433+
ret = walk_log_tree(&wc);
34343434
if (ret) {
34353435
/*
34363436
* We weren't able to traverse the entire log tree, the
@@ -7446,7 +7446,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
74467446
wc.pin = true;
74477447
wc.log = log_root_tree;
74487448

7449-
ret = walk_log_tree(trans, &wc);
7449+
ret = walk_log_tree(&wc);
74507450
wc.log = NULL;
74517451
if (ret) {
74527452
btrfs_abort_transaction(trans, ret);
@@ -7521,7 +7521,7 @@ int btrfs_recover_log_trees(struct btrfs_root *log_root_tree)
75217521
goto next;
75227522
}
75237523

7524-
ret = walk_log_tree(trans, &wc);
7524+
ret = walk_log_tree(&wc);
75257525
if (ret) {
75267526
btrfs_abort_transaction(trans, ret);
75277527
goto next;

0 commit comments

Comments
 (0)