btrfs: use GFP_NOWAIT for tree block readahead

extent_buffer readahead should not be able to painfully stall a
search_slot and hog tree locks by getting stuck in direct reclaim.

If the allocation fails, that is fine, we simply fail to do the
readahead in that case.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Boris Burkov 2026-07-21 15:42:15 -07:00 committed by David Sterba
parent 6b338068ac
commit 536e94a4c3

View File

@ -5056,7 +5056,8 @@ void btrfs_readahead_tree_block(struct btrfs_fs_info *fs_info,
.level = level,
.transid = gen
};
struct btrfs_eb_prealloc pa = { 0 };
/* Readahead is best effort so prefer to fail rather than block in reclaim. */
struct btrfs_eb_prealloc pa = { .supports_nowait = true };
struct extent_buffer *eb;
int ret;