Re: [PATCH] btrfs: turn btrfs_destroy_delayed_refs() into void function
Hi Yang, Thank you for the patch! Yet something to improve: [auto build test ERROR on kdave/for-next] [also build test ERROR on v5.12-rc2 next-20210309] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Yang-Li/btrfs-turn-btrfs_destroy_delayed_refs-into-void-function/20210309-173510 base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next config: mips-randconfig-r022-20210309 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 820f508b08d7c94b2dd7847e9710d2bc36d3dd45) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install mips cross compiling tool for clang build # apt-get install binutils-mips-linux-gnu # https://github.com/0day-ci/linux/commit/bad3b2a4dc5b9bc5b6584b104c9b13210e6b739a git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Yang-Li/btrfs-turn-btrfs_destroy_delayed_refs-into-void-function/20210309-173510 git checkout bad3b2a4dc5b9bc5b6584b104c9b13210e6b739a # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> fs/btrfs/disk-io.c:4612:10: error: use of undeclared identifier 'ret'; did >> you mean 'ref'? return ret; ^~~ ref fs/btrfs/disk-io.c:4604:33: note: 'ref' declared here struct btrfs_delayed_ref_node *ref; ^ >> fs/btrfs/disk-io.c:4612:3: error: void function 'btrfs_destroy_delayed_refs' >> should not return a value [-Wreturn-type] return ret; ^ ~~~ 2 errors generated. vim +4612 fs/btrfs/disk-io.c acce952b026382 liubo 2011-01-06 4598 bad3b2a4dc5b9b Yang Li 2021-03-09 4599 static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, 2ff7e61e0d30ff Jeff Mahoney2016-06-22 4600 struct btrfs_fs_info *fs_info) acce952b026382 liubo 2011-01-06 4601 { acce952b026382 liubo 2011-01-06 4602 struct rb_node *node; acce952b026382 liubo 2011-01-06 4603 struct btrfs_delayed_ref_root *delayed_refs; acce952b026382 liubo 2011-01-06 4604 struct btrfs_delayed_ref_node *ref; acce952b026382 liubo 2011-01-06 4605 acce952b026382 liubo 2011-01-06 4606 delayed_refs = >delayed_refs; acce952b026382 liubo 2011-01-06 4607 acce952b026382 liubo 2011-01-06 4608 spin_lock(_refs->lock); d7df2c796d7eed Josef Bacik 2014-01-23 4609 if (atomic_read(_refs->num_entries) == 0) { cfece4db110dac David Sterba2011-04-25 4610 spin_unlock(_refs->lock); b79ce33f1b David Sterba2019-11-28 4611 btrfs_debug(fs_info, "delayed_refs has NO entry"); acce952b026382 liubo 2011-01-06 @4612 return ret; acce952b026382 liubo 2011-01-06 4613 } acce952b026382 liubo 2011-01-06 4614 5c9d028b3b174e Liu Bo 2018-08-23 4615 while ((node = rb_first_cached(_refs->href_root)) != NULL) { d7df2c796d7eed Josef Bacik 2014-01-23 4616 struct btrfs_delayed_ref_head *head; 0e0adbcfdc9086 Josef Bacik 2017-10-19 4617 struct rb_node *n; e78417d1921c53 Josef Bacik 2013-06-03 4618 bool pin_bytes = false; acce952b026382 liubo 2011-01-06 4619 d7df2c796d7eed Josef Bacik 2014-01-23 4620 head = rb_entry(node, struct btrfs_delayed_ref_head, d7df2c796d7eed Josef Bacik 2014-01-23 4621 href_node); 3069bd26690a01 Josef Bacik 2018-11-21 4622 if (btrfs_delayed_ref_lock(delayed_refs, head)) b939d1ab76b4aa Josef Bacik 2012-05-31 4623 continue; 3069bd26690a01 Josef Bacik 2018-11-21 4624 d7df2c796d7eed Josef Bacik 2014-01-23 4625 spin_lock(>lock); e3d03965638428 Liu Bo 2018-08-23 4626 while ((n = rb_first_cached(>ref_tree)) != NULL) { 0e0adbcfdc9086 Josef Bacik 2017-10-19 4627 ref = rb_entry(n, struct btrfs_delayed_ref_node, 0e0adbcfdc9086 Josef Bacik 2017-10-19 4628 ref_node); d7df2c796d7eed Josef Bacik 2014-01-23 4629 ref->in_tree = 0;
Re: [PATCH] btrfs: turn btrfs_destroy_delayed_refs() into void function
On Tue, Mar 09, 2021 at 05:32:54PM +0800, Yang Li wrote: > This function always return '0' and no callers use the return value. > So make it a void function. > > This eliminates the following coccicheck warning: > ./fs/btrfs/disk-io.c:4522:5-8: Unneeded variable: "ret". Return "0" on > line 4530 > > Reported-by: Abaci Robot Can you please tell your robot to ignore this warning, I'm getting tired to explain the same thing again, https://lore.kernel.org/linux-btrfs/20210302120708.gh7...@suse.cz/ this is like 5th attempt to blindly fix a tool warning without understanding the code.
Re: [PATCH] btrfs: turn btrfs_destroy_delayed_refs() into void function
Hi Yang, Thank you for the patch! Yet something to improve: [auto build test ERROR on kdave/for-next] [also build test ERROR on v5.12-rc2 next-20210309] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Yang-Li/btrfs-turn-btrfs_destroy_delayed_refs-into-void-function/20210309-173510 base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next config: riscv-allyesconfig (attached as .config) compiler: riscv64-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/bad3b2a4dc5b9bc5b6584b104c9b13210e6b739a git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Yang-Li/btrfs-turn-btrfs_destroy_delayed_refs-into-void-function/20210309-173510 git checkout bad3b2a4dc5b9bc5b6584b104c9b13210e6b739a # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): fs/btrfs/disk-io.c: In function 'btrfs_destroy_delayed_refs': >> fs/btrfs/disk-io.c:4612:10: error: 'ret' undeclared (first use in this >> function); did you mean 'ref'? 4612 | return ret; | ^~~ | ref fs/btrfs/disk-io.c:4612:10: note: each undeclared identifier is reported only once for each function it appears in fs/btrfs/disk-io.c:4612:10: error: 'return' with a value, in function returning void [-Werror=return-type] fs/btrfs/disk-io.c:4599:13: note: declared here 4599 | static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, | ^~ cc1: some warnings being treated as errors vim +4612 fs/btrfs/disk-io.c acce952b026382 liubo 2011-01-06 4598 bad3b2a4dc5b9b Yang Li 2021-03-09 4599 static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, 2ff7e61e0d30ff Jeff Mahoney2016-06-22 4600 struct btrfs_fs_info *fs_info) acce952b026382 liubo 2011-01-06 4601 { acce952b026382 liubo 2011-01-06 4602 struct rb_node *node; acce952b026382 liubo 2011-01-06 4603 struct btrfs_delayed_ref_root *delayed_refs; acce952b026382 liubo 2011-01-06 4604 struct btrfs_delayed_ref_node *ref; acce952b026382 liubo 2011-01-06 4605 acce952b026382 liubo 2011-01-06 4606 delayed_refs = >delayed_refs; acce952b026382 liubo 2011-01-06 4607 acce952b026382 liubo 2011-01-06 4608 spin_lock(_refs->lock); d7df2c796d7eed Josef Bacik 2014-01-23 4609 if (atomic_read(_refs->num_entries) == 0) { cfece4db110dac David Sterba2011-04-25 4610 spin_unlock(_refs->lock); b79ce33f1b David Sterba2019-11-28 4611 btrfs_debug(fs_info, "delayed_refs has NO entry"); acce952b026382 liubo 2011-01-06 @4612 return ret; acce952b026382 liubo 2011-01-06 4613 } acce952b026382 liubo 2011-01-06 4614 5c9d028b3b174e Liu Bo 2018-08-23 4615 while ((node = rb_first_cached(_refs->href_root)) != NULL) { d7df2c796d7eed Josef Bacik 2014-01-23 4616 struct btrfs_delayed_ref_head *head; 0e0adbcfdc9086 Josef Bacik 2017-10-19 4617 struct rb_node *n; e78417d1921c53 Josef Bacik 2013-06-03 4618 bool pin_bytes = false; acce952b026382 liubo 2011-01-06 4619 d7df2c796d7eed Josef Bacik 2014-01-23 4620 head = rb_entry(node, struct btrfs_delayed_ref_head, d7df2c796d7eed Josef Bacik 2014-01-23 4621 href_node); 3069bd26690a01 Josef Bacik 2018-11-21 4622 if (btrfs_delayed_ref_lock(delayed_refs, head)) b939d1ab76b4aa Josef Bacik 2012-05-31 4623 continue; 3069bd26690a01 Josef Bacik 2018-11-21 4624 d7df2c796d7eed Josef Bacik 2014-01-23 4625 spin_lock(>lock); e3d03965638428 Liu Bo 2018-08-23 4626 while ((n = rb_first_cached(>ref_tree)) != NULL) { 0e0adbcfdc9086 Josef Bacik 2017-10-19 4627 ref = rb_entry(n, struct btrfs_delayed_ref_node, 0e0adbcfdc9086 Josef Bacik 2017-10-19 4628 ref_node); d7df2c796d7eed Josef Bacik 2014-01-23 4629 ref->in_tree = 0; e3d03965638428 Liu Bo
Re: [PATCH] btrfs: turn btrfs_destroy_delayed_refs() into void function
On 9/3/21 5:32 pm, Yang Li wrote: This function always return '0' and no callers use the return value. So make it a void function. This eliminates the following coccicheck warning: ./fs/btrfs/disk-io.c:4522:5-8: Unneeded variable: "ret". Return "0" on line 4530 Reported-by: Abaci Robot Signed-off-by: Yang Li Reviewed-by: Anand Jain --- fs/btrfs/disk-io.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 41b718c..b75d2d9 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -52,7 +52,7 @@ static void end_workqueue_fn(struct btrfs_work *work); static void btrfs_destroy_ordered_extents(struct btrfs_root *root); -static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, +static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, struct btrfs_fs_info *fs_info); A nit... The declare here can be removed without moving the code. Thanks, Anand static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root); static int btrfs_destroy_marked_extents(struct btrfs_fs_info *fs_info, @@ -4513,13 +4513,12 @@ static void btrfs_destroy_all_ordered_extents(struct btrfs_fs_info *fs_info) btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); } -static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, +static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, struct btrfs_fs_info *fs_info) { struct rb_node *node; struct btrfs_delayed_ref_root *delayed_refs; struct btrfs_delayed_ref_node *ref; - int ret = 0; delayed_refs = >delayed_refs; @@ -4592,8 +4591,6 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, btrfs_qgroup_destroy_extent_records(trans); spin_unlock(_refs->lock); - - return ret; } static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root)
[PATCH] btrfs: turn btrfs_destroy_delayed_refs() into void function
This function always return '0' and no callers use the return value. So make it a void function. This eliminates the following coccicheck warning: ./fs/btrfs/disk-io.c:4522:5-8: Unneeded variable: "ret". Return "0" on line 4530 Reported-by: Abaci Robot Signed-off-by: Yang Li --- fs/btrfs/disk-io.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 41b718c..b75d2d9 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -52,7 +52,7 @@ static void end_workqueue_fn(struct btrfs_work *work); static void btrfs_destroy_ordered_extents(struct btrfs_root *root); -static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, +static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, struct btrfs_fs_info *fs_info); static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root); static int btrfs_destroy_marked_extents(struct btrfs_fs_info *fs_info, @@ -4513,13 +4513,12 @@ static void btrfs_destroy_all_ordered_extents(struct btrfs_fs_info *fs_info) btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); } -static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, +static void btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, struct btrfs_fs_info *fs_info) { struct rb_node *node; struct btrfs_delayed_ref_root *delayed_refs; struct btrfs_delayed_ref_node *ref; - int ret = 0; delayed_refs = >delayed_refs; @@ -4592,8 +4591,6 @@ static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, btrfs_qgroup_destroy_extent_records(trans); spin_unlock(_refs->lock); - - return ret; } static void btrfs_destroy_delalloc_inodes(struct btrfs_root *root) -- 1.8.3.1