]> www.infradead.org Git - nvme.git/commit
btrfs: don't do extra find_extent_buffer() in do_walk_down()
authorJosef Bacik <josef@toxicpanda.com>
Tue, 7 May 2024 18:12:02 +0000 (14:12 -0400)
committerDavid Sterba <dsterba@suse.com>
Thu, 11 Jul 2024 13:33:24 +0000 (15:33 +0200)
commit58147d5a7072dbf5f392ad8b2d5328b105e0e48d
tree291109e79cb5fdc455f6da65dd76fa858d4d7367
parent45c4102f0d827e00ce6ca107a7cb158265d706da
btrfs: don't do extra find_extent_buffer() in do_walk_down()

We do find_extent_buffer(), and then if we don't find the eb in cache we
call btrfs_find_create_tree_block(), which calls find_extent_buffer()
first and then allocates the extent buffer.

The reason we're doing this is because if we don't find the extent
buffer in cache we set reada = 1.  However this doesn't matter, because
lower down we only trigger reada if !btrfs_buffer_uptodate(eb), which is
what the case would be if we didn't find the extent buffer in cache and
had to allocate it.

Clean this up to simply call btrfs_find_create_tree_block(), and then
use the fact that we're having to read the extent buffer off of disk to
go ahead and kick off readahead.

Reviewed-by: Qu Wenruo <wqu@suse.com>
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-tree.c