Commit 0aaaf10a authored by Sun YangKai's avatar Sun YangKai Committed by David Sterba
Browse files

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: default avatarSun YangKai <sunk67188@gmail.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 10de00c7
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -4667,8 +4667,8 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
		 * we didn't find a candidate key in this node, walk forward
		 * and find another one
		 */
		if (slot >= nritems) {
		path->slots[level] = slot;
		if (slot >= nritems) {
			sret = btrfs_find_next_key(root, path, min_key, level,
						  min_trans);
			if (sret == 0) {
@@ -4678,7 +4678,6 @@ int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
				goto out;
			}
		}
		path->slots[level] = slot;
		if (level == path->lowest_level) {
			ret = 0;
			/* Save our key for returning back. */