]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: pass transaction handle to write_all_supers()
authorFilipe Manana <fdmanana@suse.com>
Tue, 3 Feb 2026 17:23:20 +0000 (17:23 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:55:54 +0000 (18:55 +0200)
We are holding a transaction In every context we call write_all_supers(),
so pass the transaction handle instead of fs_info to it. This will allow
us to abort the transaction in write_all_supers() instead of calling
btrfs_handle_fs_error() in a later patch.

Reviewed-by: Qu Wenruo <wqu@suse.com>
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/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/transaction.c
fs/btrfs/tree-log.c

index 666fd54928e8465aa8992180ee8f083e4e7f62b1..cc89672694887e8f5e4ff3a2e7165f34eaacbac5 100644 (file)
@@ -4033,8 +4033,9 @@ int btrfs_get_num_tolerated_disk_barrier_failures(u64 flags)
        return min_tolerated;
 }
 
-int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors)
+int write_all_supers(struct btrfs_trans_handle *trans, int max_mirrors)
 {
+       struct btrfs_fs_info *fs_info = trans->fs_info;
        struct list_head *head;
        struct btrfs_device *dev;
        struct btrfs_super_block *sb;
index 5320da83d0cf8ec15607756aed49fd1b50f62494..081a6860861c2b16988e44b6b3f9bde60e3be4e0 100644 (file)
@@ -58,7 +58,7 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info);
 int btrfs_validate_super(const struct btrfs_fs_info *fs_info,
                         const struct btrfs_super_block *sb, int mirror_num);
 int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount);
-int write_all_supers(struct btrfs_fs_info *fs_info, int max_mirrors);
+int write_all_supers(struct btrfs_trans_handle *trans, int max_mirrors);
 int btrfs_commit_super(struct btrfs_fs_info *fs_info);
 struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,
                                        const struct btrfs_key *key);
index 8dd77c431974d1a1a1ecf5583049c977046f3f5c..8f24a025625ead9f0e668f07291d005feebab435 100644 (file)
@@ -2573,7 +2573,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
                goto scrub_continue;
        }
 
-       ret = write_all_supers(fs_info, 0);
+       ret = write_all_supers(trans, 0);
        /*
         * the super is written, we can safely allow the tree-loggers
         * to go about their business
index ac871efb976390410492945c770d59c79f9ce1ae..4f360ccf8380e2177cae5b114fb960e2beb976bc 100644 (file)
@@ -3576,7 +3576,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
 
        btrfs_set_super_log_root(fs_info->super_for_commit, log_root_start);
        btrfs_set_super_log_root_level(fs_info->super_for_commit, log_root_level);
-       ret = write_all_supers(fs_info, 1);
+       ret = write_all_supers(trans, 1);
        mutex_unlock(&fs_info->tree_log_mutex);
        if (unlikely(ret)) {
                btrfs_set_log_full_commit(trans);