]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: remove duplicate calculation of eb offset in btrfs_bin_search()
authorDavid Sterba <dsterba@suse.com>
Tue, 6 Jan 2026 16:20:24 +0000 (17:20 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:56:07 +0000 (18:56 +0200)
commit7e1e45a9e42efb77a44f331e5220cdc820a8d924
tree939d44f3b126dc0fd320d9e03b16904cd53240e8
parentb753612be0dc64744d6b027c93d32b1f895196e2
btrfs: remove duplicate calculation of eb offset in btrfs_bin_search()

In the main search loop the variable 'oil' (offset in folio) is set
twice, one duplicated when the key fits completely to the contiguous
range. We can remove it and while it's just a simple calculation, the
binary search loop is executed many times so micro optimizations add up.

The code size is reduced by 64 bytes on release config, the loop is
reorganized a bit and a few instructions shorter.

Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.c