Skip to content

Commit 0aaaf10

Browse files
Sun YangKaikdave
authored andcommitted
btrfs: avoid redundant path slot assignment in btrfs_search_forward()
Move path slot assignment before the condition check to prevent duplicate assignment. Previously, the slot was set both inside and after the 'slot >= nritems' block with no change in its value, which is unnecessary. Signed-off-by: Sun YangKai <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 10de00c commit 0aaaf10

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fs/btrfs/ctree.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4667,8 +4667,8 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
46674667
* we didn't find a candidate key in this node, walk forward
46684668
* and find another one
46694669
*/
4670+
path->slots[level] = slot;
46704671
if (slot >= nritems) {
4671-
path->slots[level] = slot;
46724672
sret = btrfs_find_next_key(root, path, min_key, level,
46734673
min_trans);
46744674
if (sret == 0) {
@@ -4678,7 +4678,6 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
46784678
goto out;
46794679
}
46804680
}
4681-
path->slots[level] = slot;
46824681
if (level == path->lowest_level) {
46834682
ret = 0;
46844683
/* Save our key for returning back. */

0 commit comments

Comments
 (0)