diff mbox series

[v2,11/11] btrfs: btrfs_drop_subtree optimize return variable

Message ID b11a794f626dd7c995607559f1835ba9011e1f3e.1713370757.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series part2 trivial adjustments for return variable coding style | expand

Commit Message

Anand Jain April 18, 2024, 7:08 a.m. UTC
retw is a helper return variable used to update the actual return value
ret. Instead, just use ret.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
v2: rework walk_up_tree() returned error, leading unusing wret. (Josef).

 fs/btrfs/extent-tree.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 17aa45b906bb..2d0c03806d80 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -6099,7 +6099,6 @@  int btrfs_drop_subtree(struct btrfs_trans_handle *trans,
 	int level;
 	int parent_level;
 	int ret = 0;
-	int wret;
 
 	BUG_ON(btrfs_root_id(root) != BTRFS_TREE_RELOC_OBJECTID);
 
@@ -6135,17 +6134,16 @@  int btrfs_drop_subtree(struct btrfs_trans_handle *trans,
 	wc->reada_count = BTRFS_NODEPTRS_PER_BLOCK(fs_info);
 
 	while (1) {
-		wret = walk_down_tree(trans, root, path, wc);
-		if (wret < 0) {
-			ret = wret;
+		ret = walk_down_tree(trans, root, path, wc);
+		if (ret < 0)
 			break;
-		}
 
-		wret = walk_up_tree(trans, root, path, wc, parent_level);
-		if (wret < 0)
-			ret = wret;
-		if (wret != 0)
+		ret = walk_up_tree(trans, root, path, wc, parent_level);
+		if (ret) {
+			if (ret > 0)
+				ret = 0;
 			break;
+		}
 	}
 
 	kfree(wc);