On 14.11.18 г. 15:35 ч., Johannes Thumshirn wrote: > Currently the function prototypes of: > * search_free_space_info() > * convert_free_space_to_bitmaps() > * convert_free_space_to_extents() > * free_space_test_bit() > * __remove_from_free_space_tree() > * __add_to_free_space_tree() > are hidden behind CONFIG_BTRFS_FS_RUN_SANITY_TESTS. > > If CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set, these functions are only > used within free-space-tree.c so technically there would be no need to provide > the function prototypes. But when CONFIG_BTRFS_FS_RUN_SANITY_TESTS they are > also used from tests/free-space-tree-tests.c which explains the need for > the function prototypes and the non-static declaration of the functions. > > When compiling with -Wmissing-prototypes and > CONFIG_BTRFS_FS_RUN_SANITY_TESTS=n gcc emits a warning for each of these > functions, so remove the ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS guard to > make the compiler happy when running 'make W=1'. 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. > > Signed-off-by: Johannes Thumshirn <jthumshirn@xxxxxxx> > --- > fs/btrfs/free-space-tree.h | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/fs/btrfs/free-space-tree.h b/fs/btrfs/free-space-tree.h > index 3133651d7d70..0f4db2ad68c8 100644 > --- a/fs/btrfs/free-space-tree.h > +++ b/fs/btrfs/free-space-tree.h > @@ -27,7 +27,6 @@ int add_to_free_space_tree(struct btrfs_trans_handle *trans, > int remove_from_free_space_tree(struct btrfs_trans_handle *trans, > u64 start, u64 size); > > -#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS > struct btrfs_free_space_info * > search_free_space_info(struct btrfs_trans_handle *trans, > struct btrfs_fs_info *fs_info, > @@ -47,6 +46,5 @@ int convert_free_space_to_extents(struct btrfs_trans_handle *trans, > struct btrfs_path *path); > int free_space_test_bit(struct btrfs_block_group_cache *block_group, > struct btrfs_path *path, u64 offset); > -#endif > > #endif >
