diff mbox series

[3/3] treewide: Fix missing declarations

Message ID 20181105190643.13578-3-rosenp@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/3] bitops: Fix big endian compilation | expand

Commit Message

Rosen Penev Nov. 5, 2018, 7:06 p.m. UTC
Found using -Wmissing-prototypes in GCC.

This should improve LTO behavior.

Note that set_free_space_tree_thresholds is an unused function. Adding
inline seems to remove the unused function warning.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 btrfs.c              |  2 +-
 check/mode-lowmem.c  |  2 +-
 extent-tree.c        |  2 +-
 free-space-tree.c    | 12 ++++++------
 libbtrfsutil/stubs.c |  1 +
 utils-lib.c          |  2 ++
 utils.h              |  1 +
 7 files changed, 13 insertions(+), 9 deletions(-)

Comments

Nikolay Borisov Nov. 5, 2018, 9:29 p.m. UTC | #1
On 5.11.18 г. 21:06 ч., Rosen Penev wrote:
> Found using -Wmissing-prototypes in GCC.
> 
> This should improve LTO behavior.
> 
> Note that set_free_space_tree_thresholds is an unused function. Adding
> inline seems to remove the unused function warning.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>


I had a series that did exactly this but since you came in first:

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  btrfs.c              |  2 +-
>  check/mode-lowmem.c  |  2 +-
>  extent-tree.c        |  2 +-
>  free-space-tree.c    | 12 ++++++------
>  libbtrfsutil/stubs.c |  1 +
>  utils-lib.c          |  2 ++
>  utils.h              |  1 +
>  7 files changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/btrfs.c b/btrfs.c
> index 2d39f2c..78c468d 100644
> --- a/btrfs.c
> +++ b/btrfs.c
> @@ -210,7 +210,7 @@ static int handle_global_options(int argc, char **argv)
>  	return shift;
>  }
>  
> -void handle_special_globals(int shift, int argc, char **argv)
> +static void handle_special_globals(int shift, int argc, char **argv)
>  {
>  	int has_help = 0;
>  	int has_full = 0;
> diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
> index 14bbc9e..94123c1 100644
> --- a/check/mode-lowmem.c
> +++ b/check/mode-lowmem.c
> @@ -953,7 +953,7 @@ out:
>   * returns 0 means success.
>   * returns not 0 means on error;
>   */
> -int repair_ternary_lowmem(struct btrfs_root *root, u64 dir_ino, u64 ino,
> +static int repair_ternary_lowmem(struct btrfs_root *root, u64 dir_ino, u64 ino,
>  			  u64 index, char *name, int name_len, u8 filetype,
>  			  int err)
>  {
> diff --git a/extent-tree.c b/extent-tree.c
> index cd98633..8c9cdef 100644
> --- a/extent-tree.c
> +++ b/extent-tree.c
> @@ -3749,7 +3749,7 @@ static void __get_extent_size(struct btrfs_root *root, struct btrfs_path *path,
>   * Return >0 for not found.
>   * Return <0 for err
>   */
> -int btrfs_search_overlap_extent(struct btrfs_root *root,
> +static int btrfs_search_overlap_extent(struct btrfs_root *root,
>  				struct btrfs_path *path, u64 bytenr, u64 len)
>  {
>  	struct btrfs_key key;
> diff --git a/free-space-tree.c b/free-space-tree.c
> index 6641cdf..6ef5792 100644
> --- a/free-space-tree.c
> +++ b/free-space-tree.c
> @@ -24,7 +24,7 @@
>  #include "bitops.h"
>  #include "internal.h"
>  
> -void set_free_space_tree_thresholds(struct btrfs_block_group_cache *cache,
> +static inline void set_free_space_tree_thresholds(struct btrfs_block_group_cache *cache,
>  				    u64 sectorsize)
>  {
>  	u32 bitmap_range;
> @@ -202,7 +202,7 @@ static void le_bitmap_set(unsigned long *map, unsigned int start, int len)
>  	}
>  }
>  
> -int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
> +static int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
>  				  struct btrfs_block_group_cache *block_group,
>  				  struct btrfs_path *path)
>  {
> @@ -341,7 +341,7 @@ out:
>  	return ret;
>  }
>  
> -int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
> +static int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
>  				  struct btrfs_block_group_cache *block_group,
>  				  struct btrfs_path *path)
>  {
> @@ -780,7 +780,7 @@ out:
>  	return ret;
>  }
>  
> -int __remove_from_free_space_tree(struct btrfs_trans_handle *trans,
> +static int __remove_from_free_space_tree(struct btrfs_trans_handle *trans,
>  				  struct btrfs_block_group_cache *block_group,
>  				  struct btrfs_path *path, u64 start, u64 size)
>  {
> @@ -960,7 +960,7 @@ out:
>  	return ret;
>  }
>  
> -int __add_to_free_space_tree(struct btrfs_trans_handle *trans,
> +static int __add_to_free_space_tree(struct btrfs_trans_handle *trans,
>  			     struct btrfs_block_group_cache *block_group,
>  			     struct btrfs_path *path, u64 start, u64 size)
>  {
> @@ -1420,7 +1420,7 @@ out:
>  	return ret;
>  }
>  
> -struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
> +static struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
>  				     struct btrfs_fs_info *fs_info,
>  				     u64 objectid)
>  {
> diff --git a/libbtrfsutil/stubs.c b/libbtrfsutil/stubs.c
> index 9b9e037..c530e40 100644
> --- a/libbtrfsutil/stubs.c
> +++ b/libbtrfsutil/stubs.c
> @@ -19,6 +19,7 @@
>  
>  #include <stdlib.h>
>  #include <errno.h>
> +#include "stubs.h"
>  
>  void *reallocarray(void *ptr, size_t nmemb, size_t size)
>  {
> diff --git a/utils-lib.c b/utils-lib.c
> index 044f93f..2ac421b 100644
> --- a/utils-lib.c
> +++ b/utils-lib.c
> @@ -5,6 +5,8 @@
>  #include <sys/ioctl.h>
>  #include <ioctl.h>
>  
> +#include "utils.h"
> +
>  #if BTRFS_FLAT_INCLUDES
>  #include "ctree.h"
>  #else
> diff --git a/utils.h b/utils.h
> index b6c00cf..7c5eb79 100644
> --- a/utils.h
> +++ b/utils.h
> @@ -29,6 +29,7 @@
>  #include "sizes.h"
>  #include "messages.h"
>  #include "ioctl.h"
> +#include "fsfeatures.h"
>  
>  #define BTRFS_SCAN_MOUNTED	(1ULL << 0)
>  #define BTRFS_SCAN_LBLKID	(1ULL << 1)
>
diff mbox series

Patch

diff --git a/btrfs.c b/btrfs.c
index 2d39f2c..78c468d 100644
--- a/btrfs.c
+++ b/btrfs.c
@@ -210,7 +210,7 @@  static int handle_global_options(int argc, char **argv)
 	return shift;
 }
 
-void handle_special_globals(int shift, int argc, char **argv)
+static void handle_special_globals(int shift, int argc, char **argv)
 {
 	int has_help = 0;
 	int has_full = 0;
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 14bbc9e..94123c1 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -953,7 +953,7 @@  out:
  * returns 0 means success.
  * returns not 0 means on error;
  */
-int repair_ternary_lowmem(struct btrfs_root *root, u64 dir_ino, u64 ino,
+static int repair_ternary_lowmem(struct btrfs_root *root, u64 dir_ino, u64 ino,
 			  u64 index, char *name, int name_len, u8 filetype,
 			  int err)
 {
diff --git a/extent-tree.c b/extent-tree.c
index cd98633..8c9cdef 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -3749,7 +3749,7 @@  static void __get_extent_size(struct btrfs_root *root, struct btrfs_path *path,
  * Return >0 for not found.
  * Return <0 for err
  */
-int btrfs_search_overlap_extent(struct btrfs_root *root,
+static int btrfs_search_overlap_extent(struct btrfs_root *root,
 				struct btrfs_path *path, u64 bytenr, u64 len)
 {
 	struct btrfs_key key;
diff --git a/free-space-tree.c b/free-space-tree.c
index 6641cdf..6ef5792 100644
--- a/free-space-tree.c
+++ b/free-space-tree.c
@@ -24,7 +24,7 @@ 
 #include "bitops.h"
 #include "internal.h"
 
-void set_free_space_tree_thresholds(struct btrfs_block_group_cache *cache,
+static inline void set_free_space_tree_thresholds(struct btrfs_block_group_cache *cache,
 				    u64 sectorsize)
 {
 	u32 bitmap_range;
@@ -202,7 +202,7 @@  static void le_bitmap_set(unsigned long *map, unsigned int start, int len)
 	}
 }
 
-int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
+static int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans,
 				  struct btrfs_block_group_cache *block_group,
 				  struct btrfs_path *path)
 {
@@ -341,7 +341,7 @@  out:
 	return ret;
 }
 
-int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
+static int convert_free_space_to_extents(struct btrfs_trans_handle *trans,
 				  struct btrfs_block_group_cache *block_group,
 				  struct btrfs_path *path)
 {
@@ -780,7 +780,7 @@  out:
 	return ret;
 }
 
-int __remove_from_free_space_tree(struct btrfs_trans_handle *trans,
+static int __remove_from_free_space_tree(struct btrfs_trans_handle *trans,
 				  struct btrfs_block_group_cache *block_group,
 				  struct btrfs_path *path, u64 start, u64 size)
 {
@@ -960,7 +960,7 @@  out:
 	return ret;
 }
 
-int __add_to_free_space_tree(struct btrfs_trans_handle *trans,
+static int __add_to_free_space_tree(struct btrfs_trans_handle *trans,
 			     struct btrfs_block_group_cache *block_group,
 			     struct btrfs_path *path, u64 start, u64 size)
 {
@@ -1420,7 +1420,7 @@  out:
 	return ret;
 }
 
-struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
+static struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
 				     struct btrfs_fs_info *fs_info,
 				     u64 objectid)
 {
diff --git a/libbtrfsutil/stubs.c b/libbtrfsutil/stubs.c
index 9b9e037..c530e40 100644
--- a/libbtrfsutil/stubs.c
+++ b/libbtrfsutil/stubs.c
@@ -19,6 +19,7 @@ 
 
 #include <stdlib.h>
 #include <errno.h>
+#include "stubs.h"
 
 void *reallocarray(void *ptr, size_t nmemb, size_t size)
 {
diff --git a/utils-lib.c b/utils-lib.c
index 044f93f..2ac421b 100644
--- a/utils-lib.c
+++ b/utils-lib.c
@@ -5,6 +5,8 @@ 
 #include <sys/ioctl.h>
 #include <ioctl.h>
 
+#include "utils.h"
+
 #if BTRFS_FLAT_INCLUDES
 #include "ctree.h"
 #else
diff --git a/utils.h b/utils.h
index b6c00cf..7c5eb79 100644
--- a/utils.h
+++ b/utils.h
@@ -29,6 +29,7 @@ 
 #include "sizes.h"
 #include "messages.h"
 #include "ioctl.h"
+#include "fsfeatures.h"
 
 #define BTRFS_SCAN_MOUNTED	(1ULL << 0)
 #define BTRFS_SCAN_LBLKID	(1ULL << 1)