summaryrefslogtreecommitdiff
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2024-10-16 10:45:47 +0100
committerDavid Sterba <dsterba@suse.com>2024-11-11 14:34:18 +0100
commit2b1ef80d68100a064f94fb2e658881b9f260cf08 (patch)
treecdbca100b7acc05a86be6ef3a9f65e09da6f42b2 /fs/btrfs/ctree.c
parenta8371fccf016c83e1c3d9fb832ebb60d783d1853 (diff)
btrfs: remove redundant level argument from read_block_for_search()
The level parameter passed to read_block_for_search() always matches the level of the extent buffer passed in the "eb_ret" parameter, which we are also extracting into the "parent_level" local variable. So remove the level parameter and instead use the "parent_level" variable which in fact has a better name (it's the level of the parent node from which we are reading a child node/leaf). Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 4f34208126f7..428c5650559a 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1508,7 +1508,7 @@ static noinline void unlock_up(struct btrfs_path *path, int level,
*/
static int
read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
- struct extent_buffer **eb_ret, int level, int slot,
+ struct extent_buffer **eb_ret, int slot,
const struct btrfs_key *key)
{
struct btrfs_fs_info *fs_info = root->fs_info;
@@ -1542,7 +1542,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
tmp = find_extent_buffer(fs_info, blocknr);
if (tmp) {
if (p->reada == READA_FORWARD_ALWAYS)
- reada_for_search(fs_info, p, level, slot, key->objectid);
+ reada_for_search(fs_info, p, parent_level, slot, key->objectid);
/* first we do an atomic uptodate check */
if (btrfs_buffer_uptodate(tmp, gen, 1) > 0) {
@@ -1568,7 +1568,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
}
if (!p->skip_locking) {
- btrfs_unlock_up_safe(p, level + 1);
+ btrfs_unlock_up_safe(p, parent_level + 1);
tmp_locked = true;
btrfs_tree_read_lock(tmp);
btrfs_release_path(p);
@@ -1595,12 +1595,12 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
}
if (!p->skip_locking) {
- btrfs_unlock_up_safe(p, level + 1);
+ btrfs_unlock_up_safe(p, parent_level + 1);
ret = -EAGAIN;
}
if (p->reada != READA_NONE)
- reada_for_search(fs_info, p, level, slot, key->objectid);
+ reada_for_search(fs_info, p, parent_level, slot, key->objectid);
tmp = btrfs_find_create_tree_block(fs_info, blocknr, check.owner_root, check.level);
if (IS_ERR(tmp)) {
@@ -2236,7 +2236,7 @@ cow_done:
goto done;
}
- err = read_block_for_search(root, p, &b, level, slot, key);
+ err = read_block_for_search(root, p, &b, slot, key);
if (err == -EAGAIN && !p->nowait)
goto again;
if (err) {
@@ -2363,7 +2363,7 @@ again:
goto done;
}
- err = read_block_for_search(root, p, &b, level, slot, key);
+ err = read_block_for_search(root, p, &b, slot, key);
if (err == -EAGAIN && !p->nowait)
goto again;
if (err) {
@@ -4969,8 +4969,7 @@ again:
}
next = c;
- ret = read_block_for_search(root, path, &next, level,
- slot, &key);
+ ret = read_block_for_search(root, path, &next, slot, &key);
if (ret == -EAGAIN && !path->nowait)
goto again;
@@ -5013,8 +5012,7 @@ again:
if (!level)
break;
- ret = read_block_for_search(root, path, &next, level,
- 0, &key);
+ ret = read_block_for_search(root, path, &next, 0, &key);
if (ret == -EAGAIN && !path->nowait)
goto again;