btrfs: remove redundant check at find_first_extent_bit_state()
authorFilipe Manana <fdmanana@suse.com>
Wed, 2 Apr 2025 12:23:45 +0000 (13:23 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:41 +0000 (14:30 +0200)
The tree_search() function always returns an entry that either contains
the search offset or the first entry in the tree that starts after the
offset. So checking at find_first_extent_bit_state() if the returned
entry ends at or after the search offset is pointless. Remove the check.

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/extent-io-tree.c

index 355c244497766c12a017d924ba99f122bcbbe500..18b10e7ed81529826e168490916f9e184aea3aa1 100644 (file)
@@ -877,7 +877,7 @@ static struct extent_state *find_first_extent_bit_state(struct extent_io_tree *t
         */
        state = tree_search(tree, start);
        while (state) {
-               if (state->end >= start && (state->state & bits))
+               if (state->state & bits)
                        return state;
                state = next_state(state);
        }