[openeuler:openEuler-1.0-LTS 1605/1605] fs/hugetlbfs/inode.c:635:3: warning: cast from 'int (*)(unsigned long, unsigned long, struct hf_args *)' to 'ktask_thread_func' (aka 'int (*)(void *, void *, void *)') converts to incompatible function type

tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: d96cd567c8d8d584405abe92c2576bf58202fa6e commit: 4733c59fabc3d9c145aca2f1c86b4872a7fb671d [1605/1605] hugetlbfs: parallelize hugetlbfs_fallocate with ktask config: x86_64-buildonly-randconfig-2004-20250501 (https://download.01.org/0day-ci/archive/20250702/202507022022.QDVHgFyQ-lkp@i...) compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250702/202507022022.QDVHgFyQ-lkp@i...) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202507022022.QDVHgFyQ-lkp@intel.com/ All warnings (new ones prefixed by >>):
fs/hugetlbfs/inode.c:635:3: warning: cast from 'int (*)(unsigned long, unsigned long, struct hf_args *)' to 'ktask_thread_func' (aka 'int (*)(void *, void *, void *)') converts to incompatible function type [-Wcast-function-type-mismatch] 635 | DEFINE_KTASK_CTL(ctl, hugetlbfs_fallocate_chunk, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | &hf_args, KTASK_PMD_MINCHUNK); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/ktask.h:139:3: note: expanded from macro 'DEFINE_KTASK_CTL' 139 | KTASK_CTL_INITIALIZER(thread_func, func_arg, min_chunk_size) \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/ktask.h:123:21: note: expanded from macro 'KTASK_CTL_INITIALIZER' 123 | .kc_thread_func = (ktask_thread_func)(thread_func), \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated.
vim +635 fs/hugetlbfs/inode.c 577 578 static int hugetlbfs_fallocate_chunk(pgoff_t start, pgoff_t end, 579 struct hf_args *args); 580 581 static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, 582 loff_t len) 583 { 584 struct inode *inode = file_inode(file); 585 struct hugetlbfs_inode_info *info = HUGETLBFS_I(inode); 586 struct hstate *h = hstate_inode(inode); 587 loff_t hpage_size = huge_page_size(h); 588 unsigned long hpage_shift = huge_page_shift(h); 589 pgoff_t start, end; 590 struct hf_args hf_args; 591 int error; 592 593 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) 594 return -EOPNOTSUPP; 595 596 if (mode & FALLOC_FL_PUNCH_HOLE) 597 return hugetlbfs_punch_hole(inode, offset, len); 598 599 /* 600 * Default preallocate case. 601 * For this range, start is rounded down and end is rounded up 602 * as well as being converted to page offsets. 603 */ 604 start = (unsigned long long)offset >> hpage_shift; 605 end = ((unsigned long long)(offset + len + hpage_size) - 1) 606 >> hpage_shift; 607 608 inode_lock(inode); 609 610 /* We need to check rlimit even when FALLOC_FL_KEEP_SIZE */ 611 error = inode_newsize_ok(inode, offset + len); 612 if (error) 613 goto out; 614 615 if ((info->seals & F_SEAL_GROW) && offset + len > inode->i_size) { 616 error = -EPERM; 617 goto out; 618 } 619 620 hf_args.file = file; 621 hf_args.parent_task = current; 622 hf_args.mm = current->mm; 623 hf_args.shared_policy = hugetlb_get_shared_policy(inode); 624 hf_args.hstate = h; 625 hf_args.mapping = inode->i_mapping; 626 hf_args.error = 0; 627 628 if (unlikely(hstate_is_gigantic(h))) { 629 /* 630 * Use multiple threads in clear_gigantic_page instead of here, 631 * so just do a 1-threaded hugetlbfs_fallocate_chunk. 632 */ 633 error = hugetlbfs_fallocate_chunk(start, end, &hf_args); 634 } else {
635 DEFINE_KTASK_CTL(ctl, hugetlbfs_fallocate_chunk, 636 &hf_args, KTASK_PMD_MINCHUNK); 637 638 error = ktask_run((void *)start, end - start, &ctl); 639 } 640 641 if (error != KTASK_RETURN_SUCCESS && hf_args.error != -EINTR) 642 goto out; 643 644 if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) 645 i_size_write(inode, offset + len); 646 inode->i_ctime = current_time(inode); 647 out: 648 inode_unlock(inode); 649 return error; 650 } 651
-- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
participants (1)
-
kernel test robot