diff options
| author | Filipe Manana <fdmanana@suse.com> | 2024-05-22 09:26:44 +0100 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2024-07-11 15:33:20 +0200 |
| commit | ded980eb3fadd79f73a1254e6b26551c4d6c8ab9 (patch) | |
| tree | b3099bf3bc557c2a7f860422d9aca31393a1d63d /fs/btrfs/super.c | |
| parent | 1f8aee298908611e62a6b86241c7451ff19684a4 (diff) | |
| download | linux-next-ded980eb3fadd79f73a1254e6b26551c4d6c8ab9.tar.gz linux-next-ded980eb3fadd79f73a1254e6b26551c4d6c8ab9.zip | |
btrfs: add and use helper to commit the current transaction
We have several places that attach to the current transaction with
btrfs_attach_transaction_barrier() and then commit the transaction if
there is one. Add a helper and use it to deduplicate this pattern.
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
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>
Diffstat (limited to 'fs/btrfs/super.c')
| -rw-r--r-- | fs/btrfs/super.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 117a355dbd7a..21d986e07500 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -2257,9 +2257,7 @@ out: static int btrfs_freeze(struct super_block *sb) { - struct btrfs_trans_handle *trans; struct btrfs_fs_info *fs_info = btrfs_sb(sb); - struct btrfs_root *root = fs_info->tree_root; set_bit(BTRFS_FS_FROZEN, &fs_info->flags); /* @@ -2268,14 +2266,7 @@ static int btrfs_freeze(struct super_block *sb) * we want to avoid on a frozen filesystem), or do the commit * ourselves. */ - trans = btrfs_attach_transaction_barrier(root); - if (IS_ERR(trans)) { - /* no transaction, don't bother */ - if (PTR_ERR(trans) == -ENOENT) - return 0; - return PTR_ERR(trans); - } - return btrfs_commit_transaction(trans); + return btrfs_commit_current_transaction(fs_info->tree_root); } static int check_dev_super(struct btrfs_device *dev) |
