Re: [PATCH] f2fs: add f2fs_ioc_[get|set]_extra_attr

From: kernel test robot
Date: Mon May 29 2023 - 02:11:04 EST


Hi Sheng,

kernel test robot noticed the following build errors:

[auto build test ERROR on jaegeuk-f2fs/dev-test]
[also build test ERROR on jaegeuk-f2fs/dev next-20230525]
[cannot apply to linus/master v6.4-rc4]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Sheng-Yong/f2fs-add-f2fs_ioc_-get-set-_extra_attr/20230529-093611
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link: https://lore.kernel.org/r/20230529013502.2230810-1-shengyong%40oppo.com
patch subject: [PATCH] f2fs: add f2fs_ioc_[get|set]_extra_attr
config: i386-randconfig-i086-20230529 (https://download.01.org/0day-ci/archive/20230529/202305291323.u3OTwJgK-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/519a8b3bbd4d743ae67c32dfef61e8bfa0951cc5
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sheng-Yong/f2fs-add-f2fs_ioc_-get-set-_extra_attr/20230529-093611
git checkout 519a8b3bbd4d743ae67c32dfef61e8bfa0951cc5
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 olddefconfig
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202305291323.u3OTwJgK-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

ld: fs/f2fs/file.o: in function `f2fs_set_compress_option_v2':
>> fs/f2fs/file.c:3996: undefined reference to `zstd_max_clevel'


vim +3996 fs/f2fs/file.c

3957
3958 static int f2fs_set_compress_option_v2(struct file *filp,
3959 unsigned long attr, __u16 *attr_size)
3960 {
3961 struct inode *inode = file_inode(filp);
3962 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
3963 struct f2fs_comp_option_v2 option;
3964 int ret = 0;
3965
3966 if (sizeof(option) < *attr_size)
3967 *attr_size = sizeof(option);
3968
3969 if (!f2fs_sb_has_compression(sbi))
3970 return -EOPNOTSUPP;
3971
3972 if (!(filp->f_mode & FMODE_WRITE))
3973 return -EBADF;
3974
3975 if (copy_from_user(&option, (void __user *)attr, *attr_size))
3976 return -EFAULT;
3977
3978 if (!f2fs_compressed_file(inode) ||
3979 option.log_cluster_size < MIN_COMPRESS_LOG_SIZE ||
3980 option.log_cluster_size > MAX_COMPRESS_LOG_SIZE ||
3981 option.algorithm >= COMPRESS_MAX)
3982 return -EINVAL;
3983
3984 if (*attr_size == sizeof(struct f2fs_comp_option_v2)) {
3985 if (option.level != 0) {
3986 switch (option.algorithm) {
3987 case COMPRESS_LZO:
3988 case COMPRESS_LZORLE:
3989 return -EINVAL;
3990 case COMPRESS_LZ4:
3991 if (option.level < LZ4HC_MIN_CLEVEL ||
3992 option.level > LZ4HC_MAX_CLEVEL)
3993 return -EINVAL;
3994 break;
3995 case COMPRESS_ZSTD:
> 3996 if (option.level > zstd_max_clevel())
3997 return -EINVAL;
3998 break;
3999 }
4000 }
4001
4002 if (option.flag > BIT(COMPRESS_MAX_FLAG) - 1)
4003 return -EINVAL;
4004 }
4005
4006 file_start_write(filp);
4007 inode_lock(inode);
4008
4009 if (f2fs_is_mmap_file(inode) || get_dirty_pages(inode)) {
4010 ret = -EBUSY;
4011 goto out;
4012 }
4013
4014 if (F2FS_HAS_BLOCKS(inode)) {
4015 ret = -EFBIG;
4016 goto out;
4017 }
4018
4019 F2FS_I(inode)->i_compress_algorithm = option.algorithm;
4020 F2FS_I(inode)->i_log_cluster_size = option.log_cluster_size;
4021 F2FS_I(inode)->i_cluster_size = BIT(option.log_cluster_size);
4022 if (*attr_size == sizeof(struct f2fs_comp_option_v2)) {
4023 F2FS_I(inode)->i_compress_level = option.level;
4024 F2FS_I(inode)->i_compress_flag = option.flag;
4025 }
4026 f2fs_mark_inode_dirty_sync(inode, true);
4027
4028 if (!f2fs_is_compress_backend_ready(inode))
4029 f2fs_warn(sbi, "compression algorithm is successfully set, "
4030 "but current kernel doesn't support this algorithm.");
4031 out:
4032 inode_unlock(inode);
4033 file_end_write(filp);
4034
4035 return ret;
4036 }
4037

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