On Wed, May 27, 2020 at 01:10:59PM +0300, Nikolay Borisov wrote: > The local 'b' variable is only used to directly read values from passed > extent buffer. So eliminate it and directly use the input parameter. Furthermore > this shrinks the size of the following functions: > > ./scripts/bloat-o-meter ctree.orig fs/btrfs/ctree.o > add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-73 (-73) > Function old new delta > read_block_for_search.isra 876 871 -5 > push_node_left 1112 1044 -68 > - struct extent_buffer *b = *eb_ret; > - blocknr = btrfs_node_blockptr(b, slot); > - gen = btrfs_node_ptr_generation(b, slot); > - parent_level = btrfs_header_level(b); > - btrfs_node_key_to_cpu(b, &first_key, slot); > + blocknr = btrfs_node_blockptr(*eb_ret, slot); > + gen = btrfs_node_ptr_generation(*eb_ret, slot); > + parent_level = btrfs_header_level(*eb_ret); > + btrfs_node_key_to_cpu(*eb_ret, &first_key, slot); It's interesting how such trivial and obvious change can improve the code generation. The removed indirection resulted in smaller function push_node_left that is not even called directly, but as there are lot of static helpers it's some intra-procedural pass that can utilize the reduced variable indirection.
