]> www.infradead.org Git - users/hch/misc.git/commitdiff
btrfs: stop passing transaction parameter to log tree walk functions
authorFilipe Manana <fdmanana@suse.com>
Wed, 27 Aug 2025 10:48:43 +0000 (11:48 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Sep 2025 06:49:18 +0000 (08:49 +0200)
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>
fs/btrfs/tree-log.c

index f039f0613a38b7a105c1afc860fe5266bc01631d..dee306101d8e772c673a2aa5bb59a2ca89027d1b 100644 (file)
@@ -2782,10 +2782,10 @@ static int clean_log_buffer(struct btrfs_trans_handle *trans,
        return 0;
 }
 
-static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
-                                  struct btrfs_path *path, int *level,
-                                  struct walk_control *wc)
+static noinline int walk_down_log_tree(struct btrfs_path *path, int *level,
+                                      struct walk_control *wc)
 {
+       struct btrfs_trans_handle *trans = wc->trans;
        struct btrfs_fs_info *fs_info = wc->log->fs_info;
        u64 bytenr;
        u64 ptr_gen;
@@ -2874,9 +2874,8 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
        return 0;
 }
 
-static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
-                                struct btrfs_path *path, int *level,
-                                struct walk_control *wc)
+static noinline int walk_up_log_tree(struct btrfs_path *path, int *level,
+                                    struct walk_control *wc)
 {
        int i;
        int slot;
@@ -2897,7 +2896,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
                                return ret;
 
                        if (wc->free) {
-                               ret = clean_log_buffer(trans, path->nodes[*level]);
+                               ret = clean_log_buffer(wc->trans, path->nodes[*level]);
                                if (ret)
                                        return ret;
                        }
@@ -2914,7 +2913,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
  * the tree freeing any blocks that have a ref count of zero after being
  * decremented.
  */
-static int walk_log_tree(struct btrfs_trans_handle *trans, struct walk_control *wc)
+static int walk_log_tree(struct walk_control *wc)
 {
        struct btrfs_root *log = wc->log;
        int ret = 0;
@@ -2934,7 +2933,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, struct walk_control *
        path->slots[level] = 0;
 
        while (1) {
-               wret = walk_down_log_tree(trans, path, &level, wc);
+               wret = walk_down_log_tree(path, &level, wc);
                if (wret > 0)
                        break;
                if (wret < 0) {
@@ -2942,7 +2941,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, struct walk_control *
                        goto out;
                }
 
-               wret = walk_up_log_tree(trans, path, &level, wc);
+               wret = walk_up_log_tree(path, &level, wc);
                if (wret > 0)
                        break;
                if (wret < 0) {
@@ -2959,7 +2958,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans, struct walk_control *
                if (ret)
                        goto out;
                if (wc->free)
-                       ret = clean_log_buffer(trans, path->nodes[orig_level]);
+                       ret = clean_log_buffer(wc->trans, path->nodes[orig_level]);
        }
 
 out:
@@ -3427,10 +3426,11 @@ static void free_log_tree(struct btrfs_trans_handle *trans,
                .free = true,
                .process_func = process_one_buffer,
                .log = log,
+               .trans = trans,
        };
 
        if (log->node) {
-               ret = walk_log_tree(trans, &wc);
+               ret = walk_log_tree(&wc);
                if (ret) {
                        /*
                         * 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)
        wc.pin = true;
        wc.log = log_root_tree;
 
-       ret = walk_log_tree(trans, &wc);
+       ret = walk_log_tree(&wc);
        wc.log = NULL;
        if (ret) {
                btrfs_abort_transaction(trans, ret);
@@ -7521,7 +7521,7 @@ again:
                        goto next;
                }
 
-               ret = walk_log_tree(trans, &wc);
+               ret = walk_log_tree(&wc);
                if (ret) {
                        btrfs_abort_transaction(trans, ret);
                        goto next;