On Wed, Nov 14, 2018 at 02:54:37PM +0100, Johannes Thumshirn wrote:
> On 14/11/2018 14:52, Nikolay Borisov wrote:
> > I agree with this patch, however you go into the gray area of
> > "everything which is exported should have btrfs_ prefix". It's up to
> > David to see if he is content with this change.
>
> Yep you're right. I think I should change it, but I'll wait for David's
> response first.
There's one prior example of the conditionally exported functions:
btrfs_find_lock_delalloc_range . This function declaration and
definition are under the ifdef and it's a simple wrapper around a static
function find_lock_delalloc_range.
I'd do the same for the functions in your list, where applies. A static
function can be better optimized and I don't want to make it harder for
the compiler just to have it exported for the tests. They're not enabled
by default and never in production builds.
So:
free-space-tree.h:
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
struct btrfs_free_space_info *btrfs_search_free_space_info(
struct btrfs_trans_handle *trans, struct btrfs_fs_info *fs_info,
struct btrfs_block_group_cache *block_group, struct btrfs_path *path,
int cow);
...
#endif
free-space-tree.c:
#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
struct btrfs_free_space_info *btrfs_search_free_space_info(
struct btrfs_trans_handle *trans, struct btrfs_fs_info *fs_info,
struct btrfs_block_group_cache *block_group, struct btrfs_path *path,
int cow)
{
return search_free_space_info(trans, fs_info, block_group, path, cow);
}
...
#endif
I hope it's a reasonable compromise among the options.