public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove pointless out label in qgroup_account_snapshot()
@ 2026-02-10 12:10 fdmanana
  2026-02-10 19:02 ` David Sterba
  2026-02-10 21:29 ` Qu Wenruo
  0 siblings, 2 replies; 3+ messages in thread
From: fdmanana @ 2026-02-10 12:10 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

The 'out' label is pointless as there are no cleanups to perform there,
we can replace every goto with a direct return.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/transaction.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 746678044fed..98fb8c515a13 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1602,16 +1602,16 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans,
 
 	ret = commit_fs_roots(trans);
 	if (ret)
-		goto out;
+		return ret;
 	ret = btrfs_qgroup_account_extents(trans);
 	if (ret < 0)
-		goto out;
+		return ret;
 
 	/* Now qgroup are all updated, we can inherit it to new qgroups */
 	ret = btrfs_qgroup_inherit(trans, btrfs_root_id(src), dst_objectid,
 				   btrfs_root_id(parent), inherit);
 	if (ret < 0)
-		goto out;
+		return ret;
 
 	/*
 	 * Now we do a simplified commit transaction, which will:
@@ -1627,23 +1627,22 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans,
 	 */
 	ret = commit_cowonly_roots(trans);
 	if (ret)
-		goto out;
+		return ret;
 	switch_commit_roots(trans);
 	ret = btrfs_write_and_wait_transaction(trans);
-	if (unlikely(ret))
+	if (unlikely(ret)) {
 		btrfs_err(fs_info,
 "error while writing out transaction during qgroup snapshot accounting: %d", ret);
+		return ret;
+	}
 
-out:
 	/*
 	 * Force parent root to be updated, as we recorded it before so its
 	 * last_trans == cur_transid.
 	 * Or it won't be committed again onto disk after later
 	 * insert_dir_item()
 	 */
-	if (!ret)
-		ret = record_root_in_trans(trans, parent, 1);
-	return ret;
+	return record_root_in_trans(trans, parent, 1);
 }
 
 /*
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: remove pointless out label in qgroup_account_snapshot()
  2026-02-10 12:10 [PATCH] btrfs: remove pointless out label in qgroup_account_snapshot() fdmanana
@ 2026-02-10 19:02 ` David Sterba
  2026-02-10 21:29 ` Qu Wenruo
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2026-02-10 19:02 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Tue, Feb 10, 2026 at 12:10:27PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> The 'out' label is pointless as there are no cleanups to perform there,
> we can replace every goto with a direct return.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: remove pointless out label in qgroup_account_snapshot()
  2026-02-10 12:10 [PATCH] btrfs: remove pointless out label in qgroup_account_snapshot() fdmanana
  2026-02-10 19:02 ` David Sterba
@ 2026-02-10 21:29 ` Qu Wenruo
  1 sibling, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2026-02-10 21:29 UTC (permalink / raw)
  To: fdmanana, linux-btrfs



在 2026/2/10 22:40, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
> 
> The 'out' label is pointless as there are no cleanups to perform there,
> we can replace every goto with a direct return.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/transaction.c | 17 ++++++++---------
>   1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
> index 746678044fed..98fb8c515a13 100644
> --- a/fs/btrfs/transaction.c
> +++ b/fs/btrfs/transaction.c
> @@ -1602,16 +1602,16 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans,
>   
>   	ret = commit_fs_roots(trans);
>   	if (ret)
> -		goto out;
> +		return ret;
>   	ret = btrfs_qgroup_account_extents(trans);
>   	if (ret < 0)
> -		goto out;
> +		return ret;
>   
>   	/* Now qgroup are all updated, we can inherit it to new qgroups */
>   	ret = btrfs_qgroup_inherit(trans, btrfs_root_id(src), dst_objectid,
>   				   btrfs_root_id(parent), inherit);
>   	if (ret < 0)
> -		goto out;
> +		return ret;
>   
>   	/*
>   	 * Now we do a simplified commit transaction, which will:
> @@ -1627,23 +1627,22 @@ static int qgroup_account_snapshot(struct btrfs_trans_handle *trans,
>   	 */
>   	ret = commit_cowonly_roots(trans);
>   	if (ret)
> -		goto out;
> +		return ret;
>   	switch_commit_roots(trans);
>   	ret = btrfs_write_and_wait_transaction(trans);
> -	if (unlikely(ret))
> +	if (unlikely(ret)) {
>   		btrfs_err(fs_info,
>   "error while writing out transaction during qgroup snapshot accounting: %d", ret);
> +		return ret;
> +	}
>   
> -out:
>   	/*
>   	 * Force parent root to be updated, as we recorded it before so its
>   	 * last_trans == cur_transid.
>   	 * Or it won't be committed again onto disk after later
>   	 * insert_dir_item()
>   	 */
> -	if (!ret)
> -		ret = record_root_in_trans(trans, parent, 1);
> -	return ret;
> +	return record_root_in_trans(trans, parent, 1);
>   }
>   
>   /*


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-10 21:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10 12:10 [PATCH] btrfs: remove pointless out label in qgroup_account_snapshot() fdmanana
2026-02-10 19:02 ` David Sterba
2026-02-10 21:29 ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox