GNU/Weeb Mailing List <[email protected]>
 help / color / mirror / Atom feed
* [ammarfaizi2-block:af/dev.btrfs 10/11] fs/btrfs/super.c:352:19: error: array type 'cpumask_var_t' (aka 'struct cpumask[1]') is not assignable
@ 2023-02-25  7:23 kernel test robot
  2023-02-25  8:27 ` Ammar Faizi
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2023-02-25  7:23 UTC (permalink / raw)
  To: Ammar Faizi; +Cc: llvm, oe-kbuild-all, Ammar Faizi, GNU/Weeb Mailing List

tree:   https://github.com/ammarfaizi2/linux-block af/dev.btrfs
head:   91361976f98a5766c0c00110ad28f6dd3b3a7de3
commit: 3afc14e1a169a4643f51ebdcf743a8efdb7f78b2 [10/11] btrfs: Add wq_cpu_set mount option
config: arm64-randconfig-r012-20230222 (https://download.01.org/0day-ci/archive/20230225/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db89896bbbd2251fff457699635acbbedeead27f)
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 arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/ammarfaizi2/linux-block/commit/3afc14e1a169a4643f51ebdcf743a8efdb7f78b2
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block af/dev.btrfs
        git checkout 3afc14e1a169a4643f51ebdcf743a8efdb7f78b2
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash fs/btrfs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> fs/btrfs/super.c:352:19: error: array type 'cpumask_var_t' (aka 'struct cpumask[1]') is not assignable
           info->wq_cpu_set = mask;
           ~~~~~~~~~~~~~~~~ ^
   1 error generated.


vim +352 fs/btrfs/super.c

   323	
   324	static int parse_wq_cpu_set(struct btrfs_fs_info *info, const char *set)
   325	{
   326		cpumask_var_t mask;
   327		char *set_copy;
   328		int ret;
   329	
   330		set_copy = kstrdup(set, GFP_KERNEL);
   331		if (!set_copy)
   332			return -ENOMEM;
   333	
   334		if (!alloc_cpumask_var(&mask, GFP_KERNEL)) {
   335			ret = -ENOMEM;
   336			goto out_fail;
   337		}
   338	
   339		wq_cpu_set_fix_cpulist(set_copy);
   340		ret = cpulist_parse(set_copy, mask);
   341		if (ret) {
   342			btrfs_err(info, "failed to parse wq_cpu_set: %d", ret);
   343			goto out_fail_cpu;
   344		}
   345	
   346		if (cpumask_empty(mask)) {
   347			ret = -EINVAL;
   348			btrfs_err(info, "wq_cpu_set cannot be empty");
   349			goto out_fail_cpu;
   350		}
   351	
 > 352		info->wq_cpu_set = mask;
   353		info->wq_cpu_set_str = set_copy;
   354		btrfs_set_and_info(info, WQ_CPU_SET, "using wq_cpu_set=%s", set_copy);
   355		return 0;
   356	
   357	out_fail_cpu:
   358		free_cpumask_var(mask);
   359	out_fail:
   360		kfree(set_copy);
   361		return ret;
   362	}
   363	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ammarfaizi2-block:af/dev.btrfs 10/11] fs/btrfs/super.c:352:19: error: array type 'cpumask_var_t' (aka 'struct cpumask[1]') is not assignable
  2023-02-25  7:23 [ammarfaizi2-block:af/dev.btrfs 10/11] fs/btrfs/super.c:352:19: error: array type 'cpumask_var_t' (aka 'struct cpumask[1]') is not assignable kernel test robot
@ 2023-02-25  8:27 ` Ammar Faizi
  0 siblings, 0 replies; 2+ messages in thread
From: Ammar Faizi @ 2023-02-25  8:27 UTC (permalink / raw)
  To: kernel test robot; +Cc: llvm, oe-kbuild-all, GNU/Weeb Mailing List

On Sat, Feb 25, 2023 at 03:23:48PM +0800, kernel test robot wrote: 
> >> fs/btrfs/super.c:352:19: error: array type 'cpumask_var_t' (aka 'struct cpumask[1]') is not assignable
>            info->wq_cpu_set = mask;
>            ~~~~~~~~~~~~~~~~ ^
>    1 error generated.

Oh, it is because cpumask_var_t is defined as a different type,
depending on CONFIG_CPUMASK_OFFSTACK.

When CONFIG_CPUMASK_OFFSTACK=y

   typedef struct cpumask *cpumask_var_t;

When CONFIG_CPUMASK_OFFSTACK is not set:

   typedef struct cpumask cpumask_var_t[1];

Let's avoid that temporary variable. The fix below...

---
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 47b9e38d6a6313a1..f2e064ba0534a39c 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -323,7 +323,6 @@ static void wq_cpu_set_fix_cpulist(char *set)
 
 static int parse_wq_cpu_set(struct btrfs_fs_info *info, const char *set)
 {
-	cpumask_var_t mask;
 	char *set_copy;
 	int ret;
 
@@ -331,31 +330,30 @@ static int parse_wq_cpu_set(struct btrfs_fs_info *info, const char *set)
 	if (!set_copy)
 		return -ENOMEM;
 
-	if (!alloc_cpumask_var(&mask, GFP_KERNEL)) {
+	if (!alloc_cpumask_var(&info->wq_cpu_set, GFP_KERNEL)) {
 		ret = -ENOMEM;
 		goto out_fail;
 	}
 
 	wq_cpu_set_fix_cpulist(set_copy);
-	ret = cpulist_parse(set_copy, mask);
+	ret = cpulist_parse(set_copy, info->wq_cpu_set);
 	if (ret) {
 		btrfs_err(info, "failed to parse wq_cpu_set: %d", ret);
 		goto out_fail_cpu;
 	}
 
-	if (cpumask_empty(mask)) {
+	if (cpumask_empty(info->wq_cpu_set)) {
 		ret = -EINVAL;
 		btrfs_err(info, "wq_cpu_set cannot be empty");
 		goto out_fail_cpu;
 	}
 
-	info->wq_cpu_set = mask;
 	info->wq_cpu_set_str = set_copy;
 	btrfs_set_and_info(info, WQ_CPU_SET, "using wq_cpu_set=%s", set_copy);
 	return 0;
 
 out_fail_cpu:
-	free_cpumask_var(mask);
+	free_cpumask_var(info->wq_cpu_set);
 out_fail:
 	kfree(set_copy);
 	return ret;


-- 
Ammar Faizi


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-25  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-25  7:23 [ammarfaizi2-block:af/dev.btrfs 10/11] fs/btrfs/super.c:352:19: error: array type 'cpumask_var_t' (aka 'struct cpumask[1]') is not assignable kernel test robot
2023-02-25  8:27 ` Ammar Faizi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox