On Wed, Nov 08, 2017 at 04:03:35PM +0800, Qu Wenruo wrote: > >> +int btrfs_check_leaf_full(struct btrfs_root *root, struct extent_buffer > >> *leaf) > >> +{ > >> + return check_leaf(root, leaf, true); > >> +} > >> + > >> +int btrfs_check_leaf_relaxed(struct btrfs_root *root, > >> + struct extent_buffer *leaf) > >> +{ > >> + return check_leaf(root, leaf, false); > >> +} > > > > Presumably the compiler will figure it out but such trivial function are > > usually defined straight into the header file so that the compiler > > inlines them. > > In that case, the function check_leaf() must be exported, so that we can > inline it in header. > > But exporting check_leaf() increases the possibility for caller to use > it incorrectly, so I prefer no to export any internal used function. > > > And compiler may or may not inline check_leaf() into > btrfs_check_leaf_relaxed() function, but it doesn't matter. > > If optimization can be done by compiler, then let compiler to do it. > > What we should do is to ensure the abstraction/interface design is good > enough, other than doing possible "over-optimization".
Though my original idea was closer to what Nikolay says, I'm fine with the way you've actually implement it. We don't need the extended check_leaf version that's hidden in the .c file. The function inlining possibilities will be limited, but this is not a performance critical code where the effects of inlining could be observale in practice (I think, no numbers to back that). -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html