All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: Anand Jain <anand.jain@oracle.com>
Subject: [PATCH v2 05/11] btrfs: relocate_tree_blocks reuse ret instead of err
Date: Thu, 18 Apr 2024 15:08:37 +0800	[thread overview]
Message-ID: <3902d080e45e3feebf29cbbf7b50d66b47ad9de2.1713370757.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1713370756.git.anand.jain@oracle.com>

Coding style fixes the function relocate_tree_blocks().
After the fix, ret is the return value variable.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v2: drop 'ret2' (Josef)

 fs/btrfs/relocation.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index aef7d286252b..bd573a0ec270 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -2742,12 +2742,11 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
 	struct btrfs_path *path;
 	struct tree_block *block;
 	struct tree_block *next;
-	int ret;
-	int err = 0;
+	int ret = 0;
 
 	path = btrfs_alloc_path();
 	if (!path) {
-		err = -ENOMEM;
+		ret = -ENOMEM;
 		goto out_free_blocks;
 	}
 
@@ -2762,8 +2761,8 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
 	/* Get first keys */
 	rbtree_postorder_for_each_entry_safe(block, next, blocks, rb_node) {
 		if (!block->key_ready) {
-			err = get_tree_block_key(fs_info, block);
-			if (err)
+			ret = get_tree_block_key(fs_info, block);
+			if (ret)
 				goto out_free_path;
 		}
 	}
@@ -2773,25 +2772,23 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,
 		node = build_backref_tree(trans, rc, &block->key,
 					  block->level, block->bytenr);
 		if (IS_ERR(node)) {
-			err = PTR_ERR(node);
+			ret = PTR_ERR(node);
 			goto out;
 		}
 
 		ret = relocate_tree_block(trans, rc, node, &block->key,
 					  path);
-		if (ret < 0) {
-			err = ret;
+		if (ret < 0)
 			break;
-		}
 	}
 out:
-	err = finish_pending_nodes(trans, rc, path, err);
+	ret = finish_pending_nodes(trans, rc, path, ret);
 
 out_free_path:
 	btrfs_free_path(path);
 out_free_blocks:
 	free_block_list(blocks);
-	return err;
+	return ret;
 }
 
 static noinline_for_stack int prealloc_file_extent_cluster(
-- 
2.41.0


  parent reply	other threads:[~2024-04-18  7:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18  7:08 [PATCH v2 00/11] part2 trivial adjustments for return variable coding style Anand Jain
2024-04-18  7:08 ` [PATCH v2 01/11] btrfs: btrfs_cleanup_fs_roots handle ret variable Anand Jain
2024-04-19 16:51   ` David Sterba
2024-04-18  7:08 ` [PATCH v2 02/11] btrfs: btrfs_write_marked_extents rename werr and err to ret Anand Jain
2024-04-18  7:08 ` [PATCH v2 03/11] btrfs: __btrfs_wait_marked_extents " Anand Jain
2024-04-18  7:08 ` [PATCH v2 04/11] btrfs: build_backref_tree rename err and ret " Anand Jain
2024-04-18  7:08 ` Anand Jain [this message]
2024-04-18  7:08 ` [PATCH v2 06/11] btrfs: btrfs_recover_relocation rename ret to ret2 and err " Anand Jain
2024-04-19 17:12   ` David Sterba
2024-04-18  7:08 ` [PATCH v2 07/11] btrfs: quick_update_accounting drop variable err Anand Jain
2024-04-18  7:08 ` [PATCH v2 08/11] btrfs: btrfs_qgroup_rescan_worker rename ret to ret2 and err to ret Anand Jain
2024-04-18  7:08 ` [PATCH v2 09/11] btrfs: lookup_extent_data_ref code optimize return Anand Jain
2024-04-18  7:08 ` [PATCH v2 10/11] btrfs: btrfs_drop_snapshot optimize return variable Anand Jain
2024-04-19 17:23   ` David Sterba
2024-04-18  7:08 ` [PATCH v2 11/11] btrfs: btrfs_drop_subtree " Anand Jain
2024-04-19 17:25 ` [PATCH v2 00/11] part2 trivial adjustments for return variable coding style David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3902d080e45e3feebf29cbbf7b50d66b47ad9de2.1713370757.git.anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.