Re: [PATCH] btrfs: make btrfs_node_key static inline
From: David Sterba <hidden>
Date: 2021-09-14 13:13:04
From: David Sterba <hidden>
Date: 2021-09-14 13:13:04
On Tue, Sep 14, 2021 at 06:53:35PM +0800, Su Yue wrote:
It looks strange that btrfs_node_key is in struct-funcs.c. So move it to ctree.h and make it static inline.
"looks strange" is not a sufficient reason. Inlining a function means that the body will be expanded at each call site, bloating the binary code. Have you measured the impact of that? There's some performance cost of an non-inline function due to the call overhead but it does not make sense to inline a function that's called rarely and not in a tight loop. If you grep for the function you'd see that it's called eg. once per function or in a loop that's not performance critical on first sight (eg. in reada_for_search).