summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2018-02-09 10:30:18 +0100
committerDavid Sterba <dsterba@suse.com>2018-03-26 15:09:36 +0200
commitf9cacae3145a07c8a2b699f18824df0cf7778431 (patch)
tree3173a3692b4dfb120261ec75196e23c04c4ab7ea /fs/btrfs/transaction.c
parentbtrfs: not a disk error if the bio_add_page fails (diff)
downloadlinux-f9cacae3145a07c8a2b699f18824df0cf7778431.tar.xz
linux-f9cacae3145a07c8a2b699f18824df0cf7778431.zip
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: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index ca2d91163af9..665438542b96 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -2013,12 +2013,13 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
run_it = 1;
mutex_unlock(&fs_info->ro_block_group_mutex);
- if (run_it)
+ if (run_it) {
ret = btrfs_start_dirty_block_groups(trans);
- }
- if (ret) {
- btrfs_end_transaction(trans);
- return ret;
+ if (ret) {
+ btrfs_end_transaction(trans);
+ return ret;
+ }
+ }
}
spin_lock(&fs_info->trans_lock);