btrfs: make tree_search_for_insert return extent_state
authorJosef Bacik <josef@toxicpanda.com>
Fri, 9 Sep 2022 21:53:35 +0000 (17:53 -0400)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Sep 2022 10:28:04 +0000 (12:28 +0200)
commite349fd3bfbe5808e1a6b2e0dc996e3da0bfe99e1
treea31c72de126a7ba071e9792569c3ed18c6111796
parentaa852dabf9646cb2517e3e7d7d9077201938a6d3
btrfs: make tree_search_for_insert return extent_state

We use this to search for an extent state, or return the nodes we need
to insert a new extent state.  This means we have the following pattern

node = tree_search_for_insert();
if (!node) {
/* alloc and insert. */
goto again;
}
state = rb_entry(node, struct extent_state, rb_node);

we don't use the node for anything else.  Making
tree_search_for_insert() return the extent_state means we can drop the
rb_node and clean this up by eliminating the rb_entry.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-io-tree.c