On Wed, May 27, 2020 at 01:10:53PM +0300, Nikolay Borisov wrote: > This function wraps the optimisation implemented by d7396f07358a, > however this optimisation is really used in only one place - > btrfs_search_slot. Just open code the optimisation and also add a > comment explaining how it works since it's not clear just by looking > at the code - the key point here is it depends on an internal invariant > that BTRFS' btree provides, namely intermediate pointers always contain > the key at slot0 at the child node. So in the case of exact match we > can safely assume that the given key will always be in slot 0 on lower > levels. > > Furthermore this results in a reduction of btrfs_search_slot's size: > > ./scripts/bloat-o-meter ctree.orig fs/btrfs/ctree.o > add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-75 (-75) > Function old new delta > btrfs_search_slot 2783 2708 -75 > Total: Before=50423, After=50348, chg -0.15% > > Signed-off-by: Nikolay Borisov <nborisov@xxxxxxxx> Added to misc-next, thanks.
