diff mbox series

[2/4] btrfs: inline wait_current_trans_commit_start in its caller

Message ID 21a09105f7c7cc9bed5c565b32d3b37964806b82.1622733245.git.dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series Slightly how START_SYNC and WAIT_SYNC work | expand

Commit Message

David Sterba June 3, 2021, 3:20 p.m. UTC
Function wait_current_trans_commit_start is now fairly trivial so it can
be inlined in its only caller.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/transaction.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

Comments

Anand Jain June 4, 2021, 12:37 p.m. UTC | #1
On 3/6/21 11:20 pm, David Sterba wrote:
> Function wait_current_trans_commit_start is now fairly trivial so it can
> be inlined in its only caller.
> 
> Signed-off-by: David Sterba <dsterba@suse.com>

Reviewed-by: Anand Jain <anand.jain@oracle.com>

Thanks, Anand

> ---
>   fs/btrfs/transaction.c | 20 +++++++-------------
>   1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index 30347e660027..73df8b81496e 100644
> --- a/fs/btrfs/transaction.c
> +++ b/fs/btrfs/transaction.c
> @@ -1870,18 +1870,6 @@ int btrfs_transaction_blocked(struct btrfs_fs_info *info)
>   	return ret;
>   }
>   
> -/*
> - * wait for the current transaction commit to start and block subsequent
> - * transaction joins
> - */
> -static void wait_current_trans_commit_start(struct btrfs_fs_info *fs_info,
> -					    struct btrfs_transaction *trans)
> -{
> -	wait_event(fs_info->transaction_blocked_wait,
> -		   trans->state >= TRANS_STATE_COMMIT_START ||
> -		   TRANS_ABORTED(trans));
> -}
> -
>   /*
>    * commit transactions asynchronously. once btrfs_commit_transaction_async
>    * returns, any subsequent transaction will not be allowed to join.
> @@ -1941,7 +1929,13 @@ int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans)
>   		__sb_writers_release(fs_info->sb, SB_FREEZE_FS);
>   
>   	schedule_work(&ac->work);
> -	wait_current_trans_commit_start(fs_info, cur_trans);
> +	/*
> +	 * Wait for the current transaction commit to start and block
> +	 * subsequent transaction joins
> +	 */
> +	wait_event(fs_info->transaction_blocked_wait,
> +		   cur_trans->state >= TRANS_STATE_COMMIT_START ||
> +		   TRANS_ABORTED(cur_trans));
>   	if (current->journal_info == trans)
>   		current->journal_info = NULL;
>   
>
diff mbox series

Patch

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 30347e660027..73df8b81496e 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1870,18 +1870,6 @@  int btrfs_transaction_blocked(struct btrfs_fs_info *info)
 	return ret;
 }
 
-/*
- * wait for the current transaction commit to start and block subsequent
- * transaction joins
- */
-static void wait_current_trans_commit_start(struct btrfs_fs_info *fs_info,
-					    struct btrfs_transaction *trans)
-{
-	wait_event(fs_info->transaction_blocked_wait,
-		   trans->state >= TRANS_STATE_COMMIT_START ||
-		   TRANS_ABORTED(trans));
-}
-
 /*
  * commit transactions asynchronously. once btrfs_commit_transaction_async
  * returns, any subsequent transaction will not be allowed to join.
@@ -1941,7 +1929,13 @@  int btrfs_commit_transaction_async(struct btrfs_trans_handle *trans)
 		__sb_writers_release(fs_info->sb, SB_FREEZE_FS);
 
 	schedule_work(&ac->work);
-	wait_current_trans_commit_start(fs_info, cur_trans);
+	/*
+	 * Wait for the current transaction commit to start and block
+	 * subsequent transaction joins
+	 */
+	wait_event(fs_info->transaction_blocked_wait,
+		   cur_trans->state >= TRANS_STATE_COMMIT_START ||
+		   TRANS_ABORTED(cur_trans));
 	if (current->journal_info == trans)
 		current->journal_info = NULL;