Re: [PATCH] btrfs: turn btrfs_destroy_delayed_refs() into void function

From: kernel test robot
Date: Tue Mar 09 2021 - 07:47:21 EST


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 <lkp@xxxxxxxxx>

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 Mahoney 2016-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 = &trans->delayed_refs;
acce952b026382 liubo 2011-01-06 4607
acce952b026382 liubo 2011-01-06 4608 spin_lock(&delayed_refs->lock);
d7df2c796d7eed Josef Bacik 2014-01-23 4609 if (atomic_read(&delayed_refs->num_entries) == 0) {
cfece4db110dac David Sterba 2011-04-25 4610 spin_unlock(&delayed_refs->lock);
b79ce3dddd3f1b David Sterba 2019-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(&delayed_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(&head->lock);
e3d03965638428 Liu Bo 2018-08-23 4626 while ((n = rb_first_cached(&head->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 2018-08-23 4630 rb_erase_cached(&ref->ref_node, &head->ref_tree);
0e0adbcfdc9086 Josef Bacik 2017-10-19 4631 RB_CLEAR_NODE(&ref->ref_node);
1d57ee941692d0 Wang Xiaoguang 2016-10-26 4632 if (!list_empty(&ref->add_list))
1d57ee941692d0 Wang Xiaoguang 2016-10-26 4633 list_del(&ref->add_list);
d7df2c796d7eed Josef Bacik 2014-01-23 4634 atomic_dec(&delayed_refs->num_entries);
d7df2c796d7eed Josef Bacik 2014-01-23 4635 btrfs_put_delayed_ref(ref);
d7df2c796d7eed Josef Bacik 2014-01-23 4636 }
54067ae95e1547 Josef Bacik 2013-04-25 4637 if (head->must_insert_reserved)
e78417d1921c53 Josef Bacik 2013-06-03 4638 pin_bytes = true;
78a6184a3ff904 Miao Xie 2012-11-21 4639 btrfs_free_delayed_extent_op(head->extent_op);
fa781cea3d6a2b Josef Bacik 2018-11-21 4640 btrfs_delete_ref_head(delayed_refs, head);
d7df2c796d7eed Josef Bacik 2014-01-23 4641 spin_unlock(&head->lock);
acce952b026382 liubo 2011-01-06 4642 spin_unlock(&delayed_refs->lock);
e78417d1921c53 Josef Bacik 2013-06-03 4643 mutex_unlock(&head->mutex);
acce952b026382 liubo 2011-01-06 4644
f603bb94abbed5 Nikolay Borisov 2020-01-20 4645 if (pin_bytes) {
f603bb94abbed5 Nikolay Borisov 2020-01-20 4646 struct btrfs_block_group *cache;
f603bb94abbed5 Nikolay Borisov 2020-01-20 4647
f603bb94abbed5 Nikolay Borisov 2020-01-20 4648 cache = btrfs_lookup_block_group(fs_info, head->bytenr);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4649 BUG_ON(!cache);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4650
f603bb94abbed5 Nikolay Borisov 2020-01-20 4651 spin_lock(&cache->space_info->lock);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4652 spin_lock(&cache->lock);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4653 cache->pinned += head->num_bytes;
f603bb94abbed5 Nikolay Borisov 2020-01-20 4654 btrfs_space_info_update_bytes_pinned(fs_info,
f603bb94abbed5 Nikolay Borisov 2020-01-20 4655 cache->space_info, head->num_bytes);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4656 cache->reserved -= head->num_bytes;
f603bb94abbed5 Nikolay Borisov 2020-01-20 4657 cache->space_info->bytes_reserved -= head->num_bytes;
f603bb94abbed5 Nikolay Borisov 2020-01-20 4658 spin_unlock(&cache->lock);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4659 spin_unlock(&cache->space_info->lock);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4660 percpu_counter_add_batch(
f603bb94abbed5 Nikolay Borisov 2020-01-20 4661 &cache->space_info->total_bytes_pinned,
f603bb94abbed5 Nikolay Borisov 2020-01-20 4662 head->num_bytes, BTRFS_TOTAL_BYTES_PINNED_BATCH);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4663
f603bb94abbed5 Nikolay Borisov 2020-01-20 4664 btrfs_put_block_group(cache);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4665
f603bb94abbed5 Nikolay Borisov 2020-01-20 4666 btrfs_error_unpin_extent_range(fs_info, head->bytenr,
f603bb94abbed5 Nikolay Borisov 2020-01-20 4667 head->bytenr + head->num_bytes - 1);
f603bb94abbed5 Nikolay Borisov 2020-01-20 4668 }
31890da0bfdd24 Josef Bacik 2018-11-21 4669 btrfs_cleanup_ref_head_accounting(fs_info, delayed_refs, head);
d278850eff3053 Josef Bacik 2017-09-29 4670 btrfs_put_delayed_ref_head(head);
acce952b026382 liubo 2011-01-06 4671 cond_resched();
acce952b026382 liubo 2011-01-06 4672 spin_lock(&delayed_refs->lock);
acce952b026382 liubo 2011-01-06 4673 }
81f7eb00ff5bb8 Jeff Mahoney 2020-02-11 4674 btrfs_qgroup_destroy_extent_records(trans);
acce952b026382 liubo 2011-01-06 4675
acce952b026382 liubo 2011-01-06 4676 spin_unlock(&delayed_refs->lock);
acce952b026382 liubo 2011-01-06 4677 }
acce952b026382 liubo 2011-01-06 4678

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip