Commit f9cacae3 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Move error handling of btrfs_start_dirty_block_groups closer to call site

Even though btrfs_start_dirty_block_groups is fairly in the beginning of
btrfs_commit_transaction outside of the critical section defined by the
transaction states it can only be run by a single comitter. In other
words it defines its own critical section thanks to the
BTRFS_TRANS_DIRTY_BG run flag and ro_block_group_mutex. However, its
error handling is outside of this critical section which is a bit
counter-intuitive. So move the error handling righ after the function is
executed and let the sole runner of dirty block groups handle the return
value. No functional changes.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 7ef2d6a7
...@@ -2013,12 +2013,13 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) ...@@ -2013,12 +2013,13 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
run_it = 1; run_it = 1;
mutex_unlock(&fs_info->ro_block_group_mutex); mutex_unlock(&fs_info->ro_block_group_mutex);
if (run_it) if (run_it) {
ret = btrfs_start_dirty_block_groups(trans); ret = btrfs_start_dirty_block_groups(trans);
} if (ret) {
if (ret) { btrfs_end_transaction(trans);
btrfs_end_transaction(trans); return ret;
return ret; }
}
} }
spin_lock(&fs_info->trans_lock); spin_lock(&fs_info->trans_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment