btrfs: rename err to ret2 in btrfs_search_slot()

Unify naming of return value to the preferred way, move the variable to
the closest scope.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba
2025-05-30 18:17:24 +02:00
parent 56fc5b18c9
commit 644dcb4316

View File

@@ -1992,7 +1992,6 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct extent_buffer *b;
int slot;
int ret;
int err;
int level;
int lowest_unlock = 1;
/* everything at write_lock_level or lower must be write locked */
@@ -2063,6 +2062,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
while (b) {
int dec = 0;
int ret2;
level = btrfs_header_level(b);
@@ -2091,16 +2091,15 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
}
if (last_level)
err = btrfs_cow_block(trans, root, b, NULL, 0,
&b,
BTRFS_NESTING_COW);
ret2 = btrfs_cow_block(trans, root, b, NULL, 0,
&b, BTRFS_NESTING_COW);
else
err = btrfs_cow_block(trans, root, b,
p->nodes[level + 1],
p->slots[level + 1], &b,
BTRFS_NESTING_COW);
if (err) {
ret = err;
ret2 = btrfs_cow_block(trans, root, b,
p->nodes[level + 1],
p->slots[level + 1], &b,
BTRFS_NESTING_COW);
if (ret2) {
ret = ret2;
goto done;
}
}
@@ -2148,12 +2147,12 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
slot--;
}
p->slots[level] = slot;
err = setup_nodes_for_search(trans, root, p, b, level, ins_len,
&write_lock_level);
if (err == -EAGAIN)
ret2 = setup_nodes_for_search(trans, root, p, b, level, ins_len,
&write_lock_level);
if (ret2 == -EAGAIN)
goto again;
if (err) {
ret = err;
if (ret2) {
ret = ret2;
goto done;
}
b = p->nodes[level];
@@ -2179,11 +2178,11 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
goto done;
}
err = read_block_for_search(root, p, &b, slot, key);
if (err == -EAGAIN && !p->nowait)
ret2 = read_block_for_search(root, p, &b, slot, key);
if (ret2 == -EAGAIN && !p->nowait)
goto again;
if (err) {
ret = err;
if (ret2) {
ret = ret2;
goto done;
}