Re: [PATCH 1/2] btrfs: convert block group refcount to refcount_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Josef,

I love your patch! Yet something to improve:

[auto build test ERROR on kdave/for-next]
[also build test ERROR on v5.8-rc3 next-20200701]
[cannot apply to btrfs/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Josef-Bacik/btrfs-convert-block-group-refcount-to-refcount_t/20200702-042305
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: nds32-allmodconfig (attached as .config)
compiler: nds32le-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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

   In file included from fs/btrfs/free-space-cache.c:14:
   fs/btrfs/ctree.h:2216:8: warning: type qualifiers ignored on function return type [-Wignored-qualifiers]
    2216 | size_t __const btrfs_get_num_csums(void);
         |        ^~~~~~~
   fs/btrfs/free-space-cache.c: In function 'btrfs_return_cluster_to_free_space':
>> fs/btrfs/free-space-cache.c:2930:13: error: passing argument 1 of 'atomic_inc' from incompatible pointer type [-Werror=incompatible-pointer-types]
    2930 |  atomic_inc(&block_group->count);
         |             ^~~~~~~~~~~~~~~~~~~
         |             |
         |             refcount_t * {aka struct refcount_struct *}
   In file included from include/linux/atomic.h:74,
                    from include/asm-generic/bitops/lock.h:5,
                    from include/asm-generic/bitops.h:32,
                    from ./arch/nds32/include/generated/asm/bitops.h:1,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/asm-generic/bug.h:19,
                    from ./arch/nds32/include/generated/asm/bug.h:1,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from include/linux/pagemap.h:8,
                    from fs/btrfs/free-space-cache.c:6:
   include/linux/atomic-fallback.h:266:22: note: expected 'atomic_t *' {aka 'struct <anonymous> *'} but argument is of type 'refcount_t *' {aka 'struct refcount_struct *'}
     266 | atomic_inc(atomic_t *v)
         |            ~~~~~~~~~~^
   fs/btrfs/free-space-cache.c: In function 'btrfs_find_space_cluster':
   fs/btrfs/free-space-cache.c:3361:14: error: passing argument 1 of 'atomic_inc' from incompatible pointer type [-Werror=incompatible-pointer-types]
    3361 |   atomic_inc(&block_group->count);
         |              ^~~~~~~~~~~~~~~~~~~
         |              |
         |              refcount_t * {aka struct refcount_struct *}
   In file included from include/linux/atomic.h:74,
                    from include/asm-generic/bitops/lock.h:5,
                    from include/asm-generic/bitops.h:32,
                    from ./arch/nds32/include/generated/asm/bitops.h:1,
                    from include/linux/bitops.h:29,
                    from include/linux/kernel.h:12,
                    from include/asm-generic/bug.h:19,
                    from ./arch/nds32/include/generated/asm/bug.h:1,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/mm.h:9,
                    from include/linux/pagemap.h:8,
                    from fs/btrfs/free-space-cache.c:6:
   include/linux/atomic-fallback.h:266:22: note: expected 'atomic_t *' {aka 'struct <anonymous> *'} but argument is of type 'refcount_t *' {aka 'struct refcount_struct *'}
     266 | atomic_inc(atomic_t *v)
         |            ~~~~~~~~~~^
   cc1: some warnings being treated as errors

vim +/atomic_inc +2930 fs/btrfs/free-space-cache.c

fa9c0d795f7b57c Chris Mason  2009-04-03  2901  
fa9c0d795f7b57c Chris Mason  2009-04-03  2902  /*
fa9c0d795f7b57c Chris Mason  2009-04-03  2903   * given a cluster, put all of its extents back into the free space
fa9c0d795f7b57c Chris Mason  2009-04-03  2904   * cache.  If a block group is passed, this function will only free
fa9c0d795f7b57c Chris Mason  2009-04-03  2905   * a cluster that belongs to the passed block group.
fa9c0d795f7b57c Chris Mason  2009-04-03  2906   *
fa9c0d795f7b57c Chris Mason  2009-04-03  2907   * Otherwise, it'll get a reference on the block group pointed to by the
fa9c0d795f7b57c Chris Mason  2009-04-03  2908   * cluster and remove the cluster from it.
fa9c0d795f7b57c Chris Mason  2009-04-03  2909   */
fa9c0d795f7b57c Chris Mason  2009-04-03  2910  int btrfs_return_cluster_to_free_space(
32da5386d9a4fd5 David Sterba 2019-10-29  2911  			       struct btrfs_block_group *block_group,
fa9c0d795f7b57c Chris Mason  2009-04-03  2912  			       struct btrfs_free_cluster *cluster)
fa9c0d795f7b57c Chris Mason  2009-04-03  2913  {
34d52cb6c50b5a4 Li Zefan     2011-03-29  2914  	struct btrfs_free_space_ctl *ctl;
fa9c0d795f7b57c Chris Mason  2009-04-03  2915  	int ret;
fa9c0d795f7b57c Chris Mason  2009-04-03  2916  
fa9c0d795f7b57c Chris Mason  2009-04-03  2917  	/* first, get a safe pointer to the block group */
fa9c0d795f7b57c Chris Mason  2009-04-03  2918  	spin_lock(&cluster->lock);
fa9c0d795f7b57c Chris Mason  2009-04-03  2919  	if (!block_group) {
fa9c0d795f7b57c Chris Mason  2009-04-03  2920  		block_group = cluster->block_group;
fa9c0d795f7b57c Chris Mason  2009-04-03  2921  		if (!block_group) {
fa9c0d795f7b57c Chris Mason  2009-04-03  2922  			spin_unlock(&cluster->lock);
fa9c0d795f7b57c Chris Mason  2009-04-03  2923  			return 0;
fa9c0d795f7b57c Chris Mason  2009-04-03  2924  		}
fa9c0d795f7b57c Chris Mason  2009-04-03  2925  	} else if (cluster->block_group != block_group) {
fa9c0d795f7b57c Chris Mason  2009-04-03  2926  		/* someone else has already freed it don't redo their work */
fa9c0d795f7b57c Chris Mason  2009-04-03  2927  		spin_unlock(&cluster->lock);
fa9c0d795f7b57c Chris Mason  2009-04-03  2928  		return 0;
fa9c0d795f7b57c Chris Mason  2009-04-03  2929  	}
fa9c0d795f7b57c Chris Mason  2009-04-03 @2930  	atomic_inc(&block_group->count);
fa9c0d795f7b57c Chris Mason  2009-04-03  2931  	spin_unlock(&cluster->lock);
fa9c0d795f7b57c Chris Mason  2009-04-03  2932  
34d52cb6c50b5a4 Li Zefan     2011-03-29  2933  	ctl = block_group->free_space_ctl;
34d52cb6c50b5a4 Li Zefan     2011-03-29  2934  
fa9c0d795f7b57c Chris Mason  2009-04-03  2935  	/* now return any extents the cluster had on it */
34d52cb6c50b5a4 Li Zefan     2011-03-29  2936  	spin_lock(&ctl->tree_lock);
fa9c0d795f7b57c Chris Mason  2009-04-03  2937  	ret = __btrfs_return_cluster_to_free_space(block_group, cluster);
34d52cb6c50b5a4 Li Zefan     2011-03-29  2938  	spin_unlock(&ctl->tree_lock);
fa9c0d795f7b57c Chris Mason  2009-04-03  2939  
6e80d4f8c422d3b Dennis Zhou  2019-12-13  2940  	btrfs_discard_queue_work(&block_group->fs_info->discard_ctl, block_group);
6e80d4f8c422d3b Dennis Zhou  2019-12-13  2941  
fa9c0d795f7b57c Chris Mason  2009-04-03  2942  	/* finally drop our ref */
fa9c0d795f7b57c Chris Mason  2009-04-03  2943  	btrfs_put_block_group(block_group);
fa9c0d795f7b57c Chris Mason  2009-04-03  2944  	return ret;
fa9c0d795f7b57c Chris Mason  2009-04-03  2945  }
fa9c0d795f7b57c Chris Mason  2009-04-03  2946  

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux