btrfs: remove pointless loop at btrfs_get_next_valid_item()
authorFilipe Manana <fdmanana@suse.com>
Wed, 5 Apr 2023 17:52:23 +0000 (18:52 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Apr 2023 17:52:19 +0000 (19:52 +0200)
commit524f14bb114a20d9b3d8db25f93b532d4207fcac
tree15a76b2ca1e18a4f5718a5db09596f4031e5fed2
parent604e6681e114d05a2e384c4d1e8ef81918037ef5
btrfs: remove pointless loop at btrfs_get_next_valid_item()

It's pointless to have a while loop at btrfs_get_next_valid_item(), as if
the slot on the current leaf is beyond the last item, we call
btrfs_next_leaf(), which leaves us at a valid slot of the next leaf (or
a valid slot in the current leaf if after releasing the path an item gets
pushed from the next leaf to the current leaf).

So just call btrfs_next_leaf() if the current slot on the current leaf is
beyond the last item.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c