]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
btrfs: pass walk_control structure to replay_one_dir_item() and replay_one_name()
authorFilipe Manana <fdmanana@suse.com>
Thu, 28 Aug 2025 12:54:40 +0000 (13:54 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Sep 2025 06:49:19 +0000 (08:49 +0200)
Instead of passing the transaction and subvolume root and log tree as
arguments, pass the walk_control structure as we can grab all of those
from the structure. This reduces the number of arguments passed and it's
going to be needed by an incoming change that improves error reporting
for log replay.

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 2ec9252115fd56289dc660c8b682210ccfde8eaf..c4c2fbf291a1d1f6c7248737ee13c47fa95f43d3 100644 (file)
@@ -1961,13 +1961,14 @@ static int delete_conflicting_dir_entry(struct btrfs_trans_handle *trans,
  * Returns < 0 on error, 0 if the name wasn't replayed (dentry points to a
  * non-existing inode) and 1 if the name was replayed.
  */
-static noinline int replay_one_name(struct btrfs_trans_handle *trans,
-                                   struct btrfs_root *root,
+static noinline int replay_one_name(struct walk_control *wc,
                                    struct btrfs_path *path,
                                    struct extent_buffer *eb,
                                    struct btrfs_dir_item *di,
                                    struct btrfs_key *key)
 {
+       struct btrfs_trans_handle *trans = wc->trans;
+       struct btrfs_root *root = wc->root;
        struct fscrypt_str name = { 0 };
        struct btrfs_dir_item *dir_dst_di;
        struct btrfs_dir_item *index_dst_di;
@@ -2107,8 +2108,7 @@ out:
 }
 
 /* Replay one dir item from a BTRFS_DIR_INDEX_KEY key. */
-static noinline int replay_one_dir_item(struct btrfs_trans_handle *trans,
-                                       struct btrfs_root *root,
+static noinline int replay_one_dir_item(struct walk_control *wc,
                                        struct btrfs_path *path,
                                        struct extent_buffer *eb, int slot,
                                        struct btrfs_key *key)
@@ -2120,7 +2120,7 @@ static noinline int replay_one_dir_item(struct btrfs_trans_handle *trans,
        ASSERT(key->type == BTRFS_DIR_INDEX_KEY);
 
        di = btrfs_item_ptr(eb, slot, struct btrfs_dir_item);
-       ret = replay_one_name(trans, root, path, eb, di, key);
+       ret = replay_one_name(wc, path, eb, di, key);
        if (ret < 0)
                return ret;
 
@@ -2156,12 +2156,12 @@ static noinline int replay_one_dir_item(struct btrfs_trans_handle *trans,
 
                fixup_path = btrfs_alloc_path();
                if (!fixup_path) {
-                       btrfs_abort_transaction(trans, -ENOMEM);
+                       btrfs_abort_transaction(wc->trans, -ENOMEM);
                        return -ENOMEM;
                }
 
                btrfs_dir_item_key_to_cpu(eb, di, &di_key);
-               ret = link_to_fixup_dir(trans, root, fixup_path, di_key.objectid);
+               ret = link_to_fixup_dir(wc->trans, wc->root, fixup_path, di_key.objectid);
                btrfs_free_path(fixup_path);
        }
 
@@ -2709,7 +2709,7 @@ static int replay_one_buffer(struct extent_buffer *eb,
 
                if (key.type == BTRFS_DIR_INDEX_KEY &&
                    wc->stage == LOG_WALK_REPLAY_DIR_INDEX) {
-                       ret = replay_one_dir_item(trans, root, path, eb, i, &key);
+                       ret = replay_one_dir_item(wc, path, eb, i, &key);
                        if (ret)
                                break;
                }