summaryrefslogtreecommitdiff
path: root/fs/btrfs/scrub.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2024-05-22 09:26:44 +0100
committerDavid Sterba <dsterba@suse.com>2024-07-11 15:33:20 +0200
commitded980eb3fadd79f73a1254e6b26551c4d6c8ab9 (patch)
treeb3099bf3bc557c2a7f860422d9aca31393a1d63d /fs/btrfs/scrub.c
parent1f8aee298908611e62a6b86241c7451ff19684a4 (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/scrub.c')
-rw-r--r--fs/btrfs/scrub.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index fe259e6a6353..4677a4f55b6a 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2441,7 +2441,6 @@ static int finish_extent_writes_for_zoned(struct btrfs_root *root,
struct btrfs_block_group *cache)
{
struct btrfs_fs_info *fs_info = cache->fs_info;
- struct btrfs_trans_handle *trans;
if (!btrfs_is_zoned(fs_info))
return 0;
@@ -2450,14 +2449,7 @@ static int finish_extent_writes_for_zoned(struct btrfs_root *root,
btrfs_wait_nocow_writers(cache);
btrfs_wait_ordered_roots(fs_info, U64_MAX, cache);
- trans = btrfs_attach_transaction_barrier(root);
- if (IS_ERR(trans)) {
- int ret = PTR_ERR(trans);
-
- return (ret == -ENOENT) ? 0 : ret;
- }
-
- return btrfs_commit_transaction(trans);
+ return btrfs_commit_current_transaction(root);
}
static noinline_for_stack