Re: [PATCH] f2fs: compress: support chksum

kernel test robot
2020-11-02T17:38:31Z

[-- Attachment #1: Type: text/plain, Size: 7594 bytes --]

Hi Chao,

I love your patch! Perhaps something to improve:

[auto build test WARNING on f2fs/dev-test]
[also build test WARNING on v5.10-rc2 next-20201102]
[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/Chao-Yu/f2fs-compress-support-chksum/20201102-202700
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
config: x86_64-randconfig-s022-20201102 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-56-gc09e8239-dirty
# https://github.com/0day-ci/linux/commit/0216dd41faf31554616bde7437532abd1dc18fbb
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chao-Yu/f2fs-compress-support-chksum/20201102-202700
git checkout 0216dd41faf31554616bde7437532abd1dc18fbb
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64

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

"sparse warnings: (new ones prefixed by >>)"
>> fs/f2fs/inode.c:459:45: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short i_compress_flag @@ got restricted __le16 [usertype] i_compress_flag @@
>> fs/f2fs/inode.c:459:45: sparse: expected unsigned short i_compress_flag
>> fs/f2fs/inode.c:459:45: sparse: got restricted __le16 [usertype] i_compress_flag

vim +459 fs/f2fs/inode.c

332
333 static int do_read_inode(struct inode *inode)
334 {
335 struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
336 struct f2fs_inode_info *fi = F2FS_I(inode);
337 struct page *node_page;
338 struct f2fs_inode *ri;
339 projid_t i_projid;
340 int err;
341
342 /* Check if ino is within scope */
343 if (f2fs_check_nid_range(sbi, inode->i_ino))
344 return -EINVAL;
345
346 node_page = f2fs_get_node_page(sbi, inode->i_ino);
347 if (IS_ERR(node_page))
348 return PTR_ERR(node_page);
349
350 ri = F2FS_INODE(node_page);
351
352 inode->i_mode = le16_to_cpu(ri->i_mode);
353 i_uid_write(inode, le32_to_cpu(ri->i_uid));
354 i_gid_write(inode, le32_to_cpu(ri->i_gid));
355 set_nlink(inode, le32_to_cpu(ri->i_links));
356 inode->i_size = le64_to_cpu(ri->i_size);
357 inode->i_blocks = SECTOR_FROM_BLOCK(le64_to_cpu(ri->i_blocks) - 1);
358
359 inode->i_atime.tv_sec = le64_to_cpu(ri->i_atime);
360 inode->i_ctime.tv_sec = le64_to_cpu(ri->i_ctime);
361 inode->i_mtime.tv_sec = le64_to_cpu(ri->i_mtime);
362 inode->i_atime.tv_nsec = le32_to_cpu(ri->i_atime_nsec);
363 inode->i_ctime.tv_nsec = le32_to_cpu(ri->i_ctime_nsec);
364 inode->i_mtime.tv_nsec = le32_to_cpu(ri->i_mtime_nsec);
365 inode->i_generation = le32_to_cpu(ri->i_generation);
366 if (S_ISDIR(inode->i_mode))
367 fi->i_current_depth = le32_to_cpu(ri->i_current_depth);
368 else if (S_ISREG(inode->i_mode))
369 fi->i_gc_failures[GC_FAILURE_PIN] =
370 le16_to_cpu(ri->i_gc_failures);
371 fi->i_xattr_nid = le32_to_cpu(ri->i_xattr_nid);
372 fi->i_flags = le32_to_cpu(ri->i_flags);
373 if (S_ISREG(inode->i_mode))
374 fi->i_flags &= ~F2FS_PROJINHERIT_FL;
375 bitmap_zero(fi->flags, FI_MAX);
376 fi->i_advise = ri->i_advise;
377 fi->i_pino = le32_to_cpu(ri->i_pino);
378 fi->i_dir_level = ri->i_dir_level;
379
380 f2fs_init_extent_tree(inode, node_page);
381
382 get_inline_info(inode, ri);
383
384 fi->i_extra_isize = f2fs_has_extra_attr(inode) ?
385 le16_to_cpu(ri->i_extra_isize) : 0;
386
387 if (f2fs_sb_has_flexible_inline_xattr(sbi)) {
388 fi->i_inline_xattr_size = le16_to_cpu(ri->i_inline_xattr_size);
389 } else if (f2fs_has_inline_xattr(inode) ||
390 f2fs_has_inline_dentry(inode)) {
391 fi->i_inline_xattr_size = DEFAULT_INLINE_XATTR_ADDRS;
392 } else {
393
394 /*
395 * Previous inline data or directory always reserved 200 bytes
396 * in inode layout, even if inline_xattr is disabled. In order
397 * to keep inline_dentry's structure for backward compatibility,
398 * we get the space back only from inline_data.
399 */
400 fi->i_inline_xattr_size = 0;
401 }
402
403 if (!sanity_check_inode(inode, node_page)) {
404 f2fs_put_page(node_page, 1);
405 return -EFSCORRUPTED;
406 }
407
408 /* check data exist */
409 if (f2fs_has_inline_data(inode) && !f2fs_exist_data(inode))
410 __recover_inline_status(inode, node_page);
411
412 /* try to recover cold bit for non-dir inode */
413 if (!S_ISDIR(inode->i_mode) && !is_cold_node(node_page)) {
414 f2fs_wait_on_page_writeback(node_page, NODE, true, true);
415 set_cold_node(node_page, false);
416 set_page_dirty(node_page);
417 }
418
419 /* get rdev by using inline_info */
420 __get_inode_rdev(inode, ri);
421
422 if (S_ISREG(inode->i_mode)) {
423 err = __written_first_block(sbi, ri);
424 if (err < 0) {
425 f2fs_put_page(node_page, 1);
426 return err;
427 }
428 if (!err)
429 set_inode_flag(inode, FI_FIRST_BLOCK_WRITTEN);
430 }
431
432 if (!f2fs_need_inode_block_update(sbi, inode->i_ino))
433 fi->last_disk_size = inode->i_size;
434
435 if (fi->i_flags & F2FS_PROJINHERIT_FL)
436 set_inode_flag(inode, FI_PROJ_INHERIT);
437
438 if (f2fs_has_extra_attr(inode) && f2fs_sb_has_project_quota(sbi) &&
439 F2FS_FITS_IN_INODE(ri, fi->i_extra_isize, i_projid))
440 i_projid = (projid_t)le32_to_cpu(ri->i_projid);
441 else
442 i_projid = F2FS_DEF_PROJID;
443 fi->i_projid = make_kprojid(&init_user_ns, i_projid);
444
445 if (f2fs_has_extra_attr(inode) && f2fs_sb_has_inode_crtime(sbi) &&
446 F2FS_FITS_IN_INODE(ri, fi->i_extra_isize, i_crtime)) {
447 fi->i_crtime.tv_sec = le64_to_cpu(ri->i_crtime);
448 fi->i_crtime.tv_nsec = le32_to_cpu(ri->i_crtime_nsec);
449 }
450
451 if (f2fs_has_extra_attr(inode) && f2fs_sb_has_compression(sbi) &&
452 (fi->i_flags & F2FS_COMPR_FL)) {
453 if (F2FS_FITS_IN_INODE(ri, fi->i_extra_isize,
454 i_log_cluster_size)) {
455 atomic_set(&fi->i_compr_blocks,
456 le64_to_cpu(ri->i_compr_blocks));
457 fi->i_compress_algorithm = ri->i_compress_algorithm;
458 fi->i_log_cluster_size = ri->i_log_cluster_size;
> 459 fi->i_compress_flag = ri->i_compress_flag;
460 fi->i_cluster_size = 1 << fi->i_log_cluster_size;
461 set_inode_flag(inode, FI_COMPRESSED_FILE);
462 }
463 }
464
465 F2FS_I(inode)->i_disk_time[0] = inode->i_atime;
466 F2FS_I(inode)->i_disk_time[1] = inode->i_ctime;
467 F2FS_I(inode)->i_disk_time[2] = inode->i_mtime;
468 F2FS_I(inode)->i_disk_time[3] = F2FS_I(inode)->i_crtime;
469 f2fs_put_page(node_page, 1);
470
471 stat_inc_inline_xattr(inode);
472 stat_inc_inline_inode(inode);
473 stat_inc_inline_dir(inode);
474 stat_inc_compr_inode(inode);
475 stat_add_compr_blocks(inode, atomic_read(&fi->i_compr_blocks));
476
477 return 0;
478 }
479

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30023 bytes --]