Hi Qu, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on kdave/for-next] [also build test WARNING on next-20200824] [cannot apply to v5.9-rc2] [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/Qu-Wenruo/btrfs-basic-refactor-of-btrfs_buffered_write/20200825-135114 base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next config: x86_64-randconfig-s022-20200825 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.2-191-g10164920-dirty # 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 sparse warnings: (new ones prefixed by >>) >> fs/btrfs/file.c:1571:20: sparse: sparse: incompatible types in comparison expression (different type sizes): >> fs/btrfs/file.c:1571:20: sparse: int * >> fs/btrfs/file.c:1571:20: sparse: unsigned long * # https://github.com/0day-ci/linux/commit/a73ab37ebab960522a0b353a6f20c8094ab911c5 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Qu-Wenruo/btrfs-basic-refactor-of-btrfs_buffered_write/20200825-135114 git checkout a73ab37ebab960522a0b353a6f20c8094ab911c5 vim +1571 fs/btrfs/file.c 1548 1549 /* Helper to get how many pages we should alloc for the batch */ 1550 static int calc_nr_pages(loff_t pos, struct iov_iter *iov) 1551 { 1552 int nr_pages; 1553 1554 /* 1555 * Try to cover the full iov range, as btrfs metadata/data reserve 1556 * and release can be pretty slow, thus the more pages we process in 1557 * one batch the better. 1558 */ 1559 nr_pages = (round_up(pos + iov_iter_count(iov), PAGE_SIZE) - 1560 round_down(pos, PAGE_SIZE)) / PAGE_SIZE; 1561 1562 nr_pages = min(nr_pages, current->nr_dirtied_pause - 1563 current->nr_dirtied); 1564 1565 /* 1566 * Limit the batch to 64K, too large batch may lead to higher memory 1567 * pressure and increase the possibility of short-copy. 1568 * With more and more short-copy, the benefit of batch copy would be 1569 * hugely reduced, as we will fall back to page-by-page copy. 1570 */ > 1571 nr_pages = min(nr_pages, SZ_64K / PAGE_SIZE); 1572 return nr_pages; 1573 } 1574 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org