* [PATCH] btrfs: Move error handling of btrfs_start_dirty_block_groups closer to call site
@ 2018-02-09 9:30 Nikolay Borisov
2018-02-14 13:32 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Nikolay Borisov @ 2018-02-09 9:30 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
Even though btrfs_start_dirty_block_groups 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>
---
fs/btrfs/transaction.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index a57065f022ff..2cdf7be02f41 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -2012,12 +2012,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);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: Move error handling of btrfs_start_dirty_block_groups closer to call site
2018-02-09 9:30 [PATCH] btrfs: Move error handling of btrfs_start_dirty_block_groups closer to call site Nikolay Borisov
@ 2018-02-14 13:32 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2018-02-14 13:32 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: linux-btrfs
On Fri, Feb 09, 2018 at 11:30:18AM +0200, Nikolay Borisov wrote:
> Even though btrfs_start_dirty_block_groups 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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-14 13:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09 9:30 [PATCH] btrfs: Move error handling of btrfs_start_dirty_block_groups closer to call site Nikolay Borisov
2018-02-14 13:32 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).