diff mbox series

[3/5] btrfs: only run delayed refs once before committing

Message ID 20200313211220.148772-4-josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series Fix up some stupid delayed ref flushing behaviors | expand

Commit Message

Josef Bacik March 13, 2020, 9:12 p.m. UTC
We try to pre-flush the delayed refs when committing, because we want to
do as little work as possible in the critical section of the transaction
commit.

However doing this twice can lead to very long transaction commit delays
as other threads are allowed to continue to generate more delayed refs,
which potentially delays the commit by multiple minutes in very extreme
cases.

So simply stick to one pre-flush, and then continue the rest of the
transaction commit.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/transaction.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Nikolay Borisov April 3, 2020, 2:34 p.m. UTC | #1
On 13.03.20 г. 23:12 ч., Josef Bacik wrote:
> We try to pre-flush the delayed refs when committing, because we want to
> do as little work as possible in the critical section of the transaction
> commit.
> 
> However doing this twice can lead to very long transaction commit delays
> as other threads are allowed to continue to generate more delayed refs,
> which potentially delays the commit by multiple minutes in very extreme
> cases.
> 
> So simply stick to one pre-flush, and then continue the rest of the
> transaction commit.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  fs/btrfs/transaction.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index cff767722a75..3e7fd8a934c1 100644
> --- a/fs/btrfs/transaction.c
> +++ b/fs/btrfs/transaction.c
> @@ -2057,12 +2057,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
>  
>  	btrfs_create_pending_block_groups(trans);
>  
> -	ret = btrfs_run_delayed_refs(trans, 0);
> -	if (ret) {
> -		btrfs_end_transaction(trans);
> -		return ret;
> -	}
> -
>  	if (!test_bit(BTRFS_TRANS_DIRTY_BG_RUN, &cur_trans->flags)) {
>  		int run_it = 0;
>  
>
diff mbox series

Patch

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index cff767722a75..3e7fd8a934c1 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -2057,12 +2057,6 @@  int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
 
 	btrfs_create_pending_block_groups(trans);
 
-	ret = btrfs_run_delayed_refs(trans, 0);
-	if (ret) {
-		btrfs_end_transaction(trans);
-		return ret;
-	}
-
 	if (!test_bit(BTRFS_TRANS_DIRTY_BG_RUN, &cur_trans->flags)) {
 		int run_it = 0;