]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: avoid re-searching tree when converting bits in an extent range
authorFilipe Manana <fdmanana@suse.com>
Wed, 16 Apr 2025 14:43:25 +0000 (15:43 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 15 May 2025 12:30:51 +0000 (14:30 +0200)
commitbe2270262fa732660b3b568175701cd732eda1da
tree9fbd4ebbe5ad669bbecf639e8c2d9edf90bcc8f8
parenteeb808422f9be2ca8ba30c0ef1d68f04c7654d87
btrfs: avoid re-searching tree when converting bits in an extent range

When converting bits for an extent range (btrfs_convert_extent_bit()), if
the current extent state record starts after the target range, we always
do a jump to the 'search_again' label, which will cause us to do a full
tree search for the next state if the current state ends before the target
range. Unless we need to reschedule, we can just grab the next state and
process it, avoiding a full tree search, even if that next state is not
contiguous, as we'll allocate and insert a new prealloc state if needed.

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