Commit abe9339d authored by Qu Wenruo's avatar Qu Wenruo Committed by David Sterba
Browse files

btrfs: ctree: Reduce one indent level for btrfs_search_old_slot()



Similar to btrfs_search_slot() done in previous patch, make a shortcut
for the level 0 case and allow to reduce indentation for the remaining
case.

Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
[ update changelog ]
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent f624d976
Loading
Loading
Loading
Loading
+34 −34
Original line number Diff line number Diff line
@@ -3005,6 +3005,8 @@ again:
	p->locks[level] = BTRFS_READ_LOCK;

	while (b) {
		int dec = 0;

		level = btrfs_header_level(b);
		p->nodes[level] = b;

@@ -3025,11 +3027,15 @@ again:
		if (ret < 0)
			goto done;

		if (level != 0) {
			int dec = 0;
		if (level == 0) {
			p->slots[level] = slot;
			unlock_up(p, level, lowest_unlock, 0, NULL);
			goto done;
		}

		if (ret && slot > 0) {
			dec = 1;
				slot -= 1;
			slot--;
		}
		p->slots[level] = slot;
		unlock_up(p, level, lowest_unlock, 0, NULL);
@@ -3040,8 +3046,7 @@ again:
			goto done;
		}

			err = read_block_for_search(root, p, &b, level,
						    slot, key);
		err = read_block_for_search(root, p, &b, level, slot, key);
		if (err == -EAGAIN)
			goto again;
		if (err) {
@@ -3061,11 +3066,6 @@ again:
		}
		p->locks[level] = BTRFS_READ_LOCK;
		p->nodes[level] = b;
		} else {
			p->slots[level] = slot;
			unlock_up(p, level, lowest_unlock, 0, NULL);
			goto done;
		}
	}
	ret = 1;
done: