Re: [PATCH v1.1 9/9] btrfs-progs: Cleanup warning reported by -Wmissing-prototypes
On Tue, Dec 04, 2018 at 08:24:38PM +0800, Qu Wenruo wrote: > > > On 2018/12/4 下午8:22, David Sterba wrote: > > On Fri, Nov 16, 2018 at 04:04:51PM +0800, Qu Wenruo wrote: > >> The following missing prototypes will be fixed: > >> 1) btrfs.c::handle_special_globals() > >> 2) check/mode-lowmem.c::repair_ternary_lowmem() > >> 3) extent-tree.c::btrfs_search_overlap_extent() > >> Above 3 can be fixed by making them static > >> > >> 4) utils.c::btrfs_check_nodesize() > >> Fixed by moving it to fsfeatures.c > >> > >> 5) chunk-recover.c::btrfs_recover_chunk_tree() > >> 6) super-recover.c::btrfs_recover_superblocks() > >> Fixed by moving the declaration from cmds-rescue.c to rescue.h > >> > >> 7) utils-lib.c::arg_strtou64() > >> 8) utils-lib.c::lookup_path_rootid() > >> Fixed by include "utils.h" > >> > >> 9) free-space-tree.c::set_free_space_tree_thresholds() > >> Fixed by deleting it, as there is no user. > >> > >> 10) free-space-tree.c::convert_free_space_to_bitmaps() > >> 11) free-space-tree.c::convert_free_space_to_extents() > >> 12) free-space-tree.c::__remove_from_free_space_tree() > >> 13) free-space-tree.c::__add_to_free_space_tree() > >> 14) free-space-tree.c::btrfs_create_tree() > >> Fixed by making them static. > > > > Please split this to more patches grouped by the type of change. > > No problem, just as the numbering is already grouped. Note that 1-3 and 10-14 are the same group.
Re: [PATCH v1.1 9/9] btrfs-progs: Cleanup warning reported by -Wmissing-prototypes
On 2018/12/4 下午8:22, David Sterba wrote: > On Fri, Nov 16, 2018 at 04:04:51PM +0800, Qu Wenruo wrote: >> The following missing prototypes will be fixed: >> 1) btrfs.c::handle_special_globals() >> 2) check/mode-lowmem.c::repair_ternary_lowmem() >> 3) extent-tree.c::btrfs_search_overlap_extent() >> Above 3 can be fixed by making them static >> >> 4) utils.c::btrfs_check_nodesize() >> Fixed by moving it to fsfeatures.c >> >> 5) chunk-recover.c::btrfs_recover_chunk_tree() >> 6) super-recover.c::btrfs_recover_superblocks() >> Fixed by moving the declaration from cmds-rescue.c to rescue.h >> >> 7) utils-lib.c::arg_strtou64() >> 8) utils-lib.c::lookup_path_rootid() >> Fixed by include "utils.h" >> >> 9) free-space-tree.c::set_free_space_tree_thresholds() >> Fixed by deleting it, as there is no user. >> >> 10) free-space-tree.c::convert_free_space_to_bitmaps() >> 11) free-space-tree.c::convert_free_space_to_extents() >> 12) free-space-tree.c::__remove_from_free_space_tree() >> 13) free-space-tree.c::__add_to_free_space_tree() >> 14) free-space-tree.c::btrfs_create_tree() >> Fixed by making them static. > > Please split this to more patches grouped by the type of change. No problem, just as the numbering is already grouped. Thanks, Qu > >> --- /dev/null >> +++ b/rescue.h >> @@ -0,0 +1,14 @@ >> +/* >> + * Copyright (C) 2018 SUSE. All rights reserved. >> + * >> + * This program is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU General Public >> + * License v2 as published by the Free Software Foundation. >> + * >> + * This program is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + * General Public License for more details. >> + */ > > Missing ifdef to prevent multiple inclusion > >> +int btrfs_recover_superblocks(const char *path, int verbose, int yes); >> +int btrfs_recover_chunk_tree(const char *path, int verbose, int yes); signature.asc Description: OpenPGP digital signature
Re: [PATCH v1.1 9/9] btrfs-progs: Cleanup warning reported by -Wmissing-prototypes
On Fri, Nov 16, 2018 at 04:04:51PM +0800, Qu Wenruo wrote: > The following missing prototypes will be fixed: > 1) btrfs.c::handle_special_globals() > 2) check/mode-lowmem.c::repair_ternary_lowmem() > 3) extent-tree.c::btrfs_search_overlap_extent() > Above 3 can be fixed by making them static > > 4) utils.c::btrfs_check_nodesize() > Fixed by moving it to fsfeatures.c > > 5) chunk-recover.c::btrfs_recover_chunk_tree() > 6) super-recover.c::btrfs_recover_superblocks() > Fixed by moving the declaration from cmds-rescue.c to rescue.h > > 7) utils-lib.c::arg_strtou64() > 8) utils-lib.c::lookup_path_rootid() > Fixed by include "utils.h" > > 9) free-space-tree.c::set_free_space_tree_thresholds() > Fixed by deleting it, as there is no user. > > 10) free-space-tree.c::convert_free_space_to_bitmaps() > 11) free-space-tree.c::convert_free_space_to_extents() > 12) free-space-tree.c::__remove_from_free_space_tree() > 13) free-space-tree.c::__add_to_free_space_tree() > 14) free-space-tree.c::btrfs_create_tree() > Fixed by making them static. Please split this to more patches grouped by the type of change. > --- /dev/null > +++ b/rescue.h > @@ -0,0 +1,14 @@ > +/* > + * Copyright (C) 2018 SUSE. All rights reserved. > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public > + * License v2 as published by the Free Software Foundation. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * General Public License for more details. > + */ Missing ifdef to prevent multiple inclusion > +int btrfs_recover_superblocks(const char *path, int verbose, int yes); > +int btrfs_recover_chunk_tree(const char *path, int verbose, int yes);
Re: [PATCH v1.1 9/9] btrfs-progs: Cleanup warning reported by -Wmissing-prototypes
On 16.11.18 г. 10:04 ч., Qu Wenruo wrote: > The following missing prototypes will be fixed: > 1) btrfs.c::handle_special_globals() > 2) check/mode-lowmem.c::repair_ternary_lowmem() > 3) extent-tree.c::btrfs_search_overlap_extent() > Above 3 can be fixed by making them static > > 4) utils.c::btrfs_check_nodesize() > Fixed by moving it to fsfeatures.c > > 5) chunk-recover.c::btrfs_recover_chunk_tree() > 6) super-recover.c::btrfs_recover_superblocks() > Fixed by moving the declaration from cmds-rescue.c to rescue.h > > 7) utils-lib.c::arg_strtou64() > 8) utils-lib.c::lookup_path_rootid() > Fixed by include "utils.h" > > 9) free-space-tree.c::set_free_space_tree_thresholds() > Fixed by deleting it, as there is no user. > > 10) free-space-tree.c::convert_free_space_to_bitmaps() > 11) free-space-tree.c::convert_free_space_to_extents() > 12) free-space-tree.c::__remove_from_free_space_tree() > 13) free-space-tree.c::__add_to_free_space_tree() > 14) free-space-tree.c::btrfs_create_tree() > Fixed by making them static. > > Signed-off-by: Qu Wenruo Reviewed-by: Nikolay Borisov > --- > changelog: > v1.1 >Update the subject, as we free space tree will also be cleaned up. > --- > btrfs.c | 2 +- > check/mode-lowmem.c | 6 ++--- > chunk-recover.c | 1 + > cmds-rescue.c | 4 +-- > extent-tree.c | 2 +- > free-space-tree.c | 59 - > fsfeatures.c| 22 + > rescue.h| 14 +++ > super-recover.c | 1 + > utils-lib.c | 1 + > utils.c | 23 -- > 11 files changed, 60 insertions(+), 75 deletions(-) > create mode 100644 rescue.h > > diff --git a/btrfs.c b/btrfs.c > index 2d39f2ced3e8..78c468d2e050 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 14bbc9ee6cb6..f56b5e8d45dc 100644 > --- a/check/mode-lowmem.c > +++ b/check/mode-lowmem.c > @@ -953,9 +953,9 @@ out: > * returns 0 means success. > * returns not 0 means on error; > */ > -int repair_ternary_lowmem(struct btrfs_root *root, u64 dir_ino, u64 ino, > - u64 index, char *name, int name_len, u8 filetype, > - int err) > +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) > { > struct btrfs_trans_handle *trans; > int stage = 0; > diff --git a/chunk-recover.c b/chunk-recover.c > index 1d30db51d8ed..1e554b8e8750 100644 > --- a/chunk-recover.c > +++ b/chunk-recover.c > @@ -40,6 +40,7 @@ > #include "utils.h" > #include "btrfsck.h" > #include "commands.h" > +#include "rescue.h" > > struct recover_control { > int verbose; > diff --git a/cmds-rescue.c b/cmds-rescue.c > index 2bc50c0841ed..36e9e1277e40 100644 > --- a/cmds-rescue.c > +++ b/cmds-rescue.c > @@ -26,15 +26,13 @@ > #include "commands.h" > #include "utils.h" > #include "help.h" > +#include "rescue.h" > > static const char * const rescue_cmd_group_usage[] = { > "btrfs rescue [options] ", > NULL > }; > > -int btrfs_recover_chunk_tree(const char *path, int verbose, int yes); > -int btrfs_recover_superblocks(const char *path, int verbose, int yes); > - > static const char * const cmd_rescue_chunk_recover_usage[] = { > "btrfs rescue chunk-recover [options] ", > "Recover the chunk tree by scanning the devices one by one.", > diff --git a/extent-tree.c b/extent-tree.c > index cd98633992ac..8c9cdeff3b02 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 6641cdfa42ba..af141e6e611a 100644 > --- a/free-space-tree.c > +++ b/free-space-tree.c > @@ -24,35 +24,6 @@ > #include "bitops.h" > #include "internal.h" > > -void set_free_space_tree_thresholds(struct btrfs_block_group_cache *cache, > - u64 sectorsize) > -{ > - u32 bitmap_range; > - size_t bitmap_size; > - u64 num_bitmaps, total_bitmap_size; > - > - /* > - * We convert to bitmaps when the disk space required for using extents > - * exceeds
[PATCH v1.1 9/9] btrfs-progs: Cleanup warning reported by -Wmissing-prototypes
The following missing prototypes will be fixed: 1) btrfs.c::handle_special_globals() 2) check/mode-lowmem.c::repair_ternary_lowmem() 3) extent-tree.c::btrfs_search_overlap_extent() Above 3 can be fixed by making them static 4) utils.c::btrfs_check_nodesize() Fixed by moving it to fsfeatures.c 5) chunk-recover.c::btrfs_recover_chunk_tree() 6) super-recover.c::btrfs_recover_superblocks() Fixed by moving the declaration from cmds-rescue.c to rescue.h 7) utils-lib.c::arg_strtou64() 8) utils-lib.c::lookup_path_rootid() Fixed by include "utils.h" 9) free-space-tree.c::set_free_space_tree_thresholds() Fixed by deleting it, as there is no user. 10) free-space-tree.c::convert_free_space_to_bitmaps() 11) free-space-tree.c::convert_free_space_to_extents() 12) free-space-tree.c::__remove_from_free_space_tree() 13) free-space-tree.c::__add_to_free_space_tree() 14) free-space-tree.c::btrfs_create_tree() Fixed by making them static. Signed-off-by: Qu Wenruo --- changelog: v1.1 Update the subject, as we free space tree will also be cleaned up. --- btrfs.c | 2 +- check/mode-lowmem.c | 6 ++--- chunk-recover.c | 1 + cmds-rescue.c | 4 +-- extent-tree.c | 2 +- free-space-tree.c | 59 - fsfeatures.c| 22 + rescue.h| 14 +++ super-recover.c | 1 + utils-lib.c | 1 + utils.c | 23 -- 11 files changed, 60 insertions(+), 75 deletions(-) create mode 100644 rescue.h diff --git a/btrfs.c b/btrfs.c index 2d39f2ced3e8..78c468d2e050 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 14bbc9ee6cb6..f56b5e8d45dc 100644 --- a/check/mode-lowmem.c +++ b/check/mode-lowmem.c @@ -953,9 +953,9 @@ out: * returns 0 means success. * returns not 0 means on error; */ -int repair_ternary_lowmem(struct btrfs_root *root, u64 dir_ino, u64 ino, - u64 index, char *name, int name_len, u8 filetype, - int err) +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) { struct btrfs_trans_handle *trans; int stage = 0; diff --git a/chunk-recover.c b/chunk-recover.c index 1d30db51d8ed..1e554b8e8750 100644 --- a/chunk-recover.c +++ b/chunk-recover.c @@ -40,6 +40,7 @@ #include "utils.h" #include "btrfsck.h" #include "commands.h" +#include "rescue.h" struct recover_control { int verbose; diff --git a/cmds-rescue.c b/cmds-rescue.c index 2bc50c0841ed..36e9e1277e40 100644 --- a/cmds-rescue.c +++ b/cmds-rescue.c @@ -26,15 +26,13 @@ #include "commands.h" #include "utils.h" #include "help.h" +#include "rescue.h" static const char * const rescue_cmd_group_usage[] = { "btrfs rescue [options] ", NULL }; -int btrfs_recover_chunk_tree(const char *path, int verbose, int yes); -int btrfs_recover_superblocks(const char *path, int verbose, int yes); - static const char * const cmd_rescue_chunk_recover_usage[] = { "btrfs rescue chunk-recover [options] ", "Recover the chunk tree by scanning the devices one by one.", diff --git a/extent-tree.c b/extent-tree.c index cd98633992ac..8c9cdeff3b02 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 6641cdfa42ba..af141e6e611a 100644 --- a/free-space-tree.c +++ b/free-space-tree.c @@ -24,35 +24,6 @@ #include "bitops.h" #include "internal.h" -void set_free_space_tree_thresholds(struct btrfs_block_group_cache *cache, - u64 sectorsize) -{ - u32 bitmap_range; - size_t bitmap_size; - u64 num_bitmaps, total_bitmap_size; - - /* -* We convert to bitmaps when the disk space required for using extents -* exceeds that required for using bitmaps. -*/ - bitmap_range = sectorsize * BTRFS_FREE_SPACE_BITMAP_BITS; - num_bitmaps = div_u64(cache->key.offset + bitmap_range - 1, - bitmap_range); - bitmap_size = sizeof(struct btrfs_item) + BTRFS_FREE_SPACE_BITMAP_SIZE; -