]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: speed up and simplify generic_bin_search
authorDavid Sterba <dsterba@suse.com>
Wed, 29 Apr 2020 21:23:37 +0000 (23:23 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 May 2020 09:25:33 +0000 (11:25 +0200)
commit2d82d9557b7db0a27a23517d71da62056ad58e4e
tree4dc319fad6bf754e73054a0fcd529d18ad203549
parentd2b78aa57e840eb649e7f90df63a403f00aab733
btrfs: speed up and simplify generic_bin_search

The bin search jumps over the extent buffer item keys, comparing
directly the bytes if the key is in one page, or storing it in a
temporary buffer in case it spans two pages.

The mapping start and length are obtained from map_private_extent_buffer,
which is heavy weight compared to what we need. We know the key size and
can find out the eb page in a simple way.  For keys spanning two pages
the fallback read_extent_buffer is used.

The temporary variables are reduced and moved to the scope of use.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c