btrfs: cleanup extent buffer readahead
We're going to pass around more information when we allocate extent buffers, in order to make that cleaner how we do readahead. Most of the callers have the parent node that we're getting our blockptr from, with the sole exception of relocation which simply has the bytenr it wants to read. Add a helper that takes the current arguments that we need (bytenr and gen), and add another helper for simply reading the slot out of a node. In followup patches the helper that takes all the extra arguments will be expanded, and the simpler helper won't need to have it's arguments adjusted. Reviewed-by: Filipe Manana <fdmanana@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>
This commit is contained in:
committed by
David Sterba
parent
416e3445ef
commit
bfb484d922
@@ -953,22 +953,6 @@ static const struct address_space_operations btree_aops = {
|
||||
.set_page_dirty = btree_set_page_dirty,
|
||||
};
|
||||
|
||||
void readahead_tree_block(struct btrfs_fs_info *fs_info, u64 bytenr)
|
||||
{
|
||||
struct extent_buffer *buf = NULL;
|
||||
int ret;
|
||||
|
||||
buf = btrfs_find_create_tree_block(fs_info, bytenr);
|
||||
if (IS_ERR(buf))
|
||||
return;
|
||||
|
||||
ret = read_extent_buffer_pages(buf, WAIT_NONE, 0);
|
||||
if (ret < 0)
|
||||
free_extent_buffer_stale(buf);
|
||||
else
|
||||
free_extent_buffer(buf);
|
||||
}
|
||||
|
||||
struct extent_buffer *btrfs_find_create_tree_block(
|
||||
struct btrfs_fs_info *fs_info,
|
||||
u64 bytenr)
|
||||
|
||||
Reference in New Issue
Block a user