Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

-1
-1
fs/btrfs/ctree.c
··· 781 781 const unsigned long idx = get_eb_folio_index(eb, offset); 782 782 char *kaddr = folio_address(eb->folios[idx]); 783 783 784 - oil = get_eb_offset_in_folio(eb, offset); 785 784 tmp = (struct btrfs_disk_key *)(kaddr + oil); 786 785 } else { 787 786 read_extent_buffer(eb, &unaligned, offset, key_size);