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/space-info.c | |
parent | 1f8aee298908611e62a6b86241c7451ff19684a4 (diff) |
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/space-info.c')
-rw-r--r-- | fs/btrfs/space-info.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c index ef68a478ad63..85ff44a74223 100644 --- a/fs/btrfs/space-info.c +++ b/fs/btrfs/space-info.c @@ -823,14 +823,7 @@ static void flush_space(struct btrfs_fs_info *fs_info, * because that does not wait for a transaction to fully commit * (only for it to be unblocked, state TRANS_STATE_UNBLOCKED). */ - trans = btrfs_attach_transaction_barrier(root); - if (IS_ERR(trans)) { - ret = PTR_ERR(trans); - if (ret == -ENOENT) - ret = 0; - break; - } - ret = btrfs_commit_transaction(trans); + ret = btrfs_commit_current_transaction(root); break; default: ret = -ENOSPC; |