CC: kbuild-all(a)lists.01.org In-Reply-To: <20210724074124.25731-5-jianchao.wan9@gmail.com> References: <20210724074124.25731-5-jianchao.wan9@gmail.com> TO: Wang Jianchao TO: linux-ext4(a)vger.kernel.org TO: linux-kernel(a)vger.kernel.org CC: tytso(a)mit.edu CC: adilger.kernel(a)dilger.ca Hi Wang, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on ext4/dev] [also build test WARNING on linux/master linus/master v5.14-rc3 next-20210723] [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/Wang-Jianchao/ext4-get-discard-out-of-jbd2-commit-context/20210724-154426 base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev :::::: branch date: 3 days ago :::::: commit date: 3 days ago config: mips-randconfig-s031-20210726 (attached as .config) compiler: mips-linux-gcc (GCC) 10.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # apt-get install sparse # sparse version: v0.6.3-341-g8af24329-dirty # https://github.com/0day-ci/linux/commit/c1714c046fe748ad2324623d650c2dfe5b3b7a55 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Wang-Jianchao/ext4-get-discard-out-of-jbd2-commit-context/20210724-154426 git checkout c1714c046fe748ad2324623d650c2dfe5b3b7a55 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash fs/ext4/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot sparse warnings: (new ones prefixed by >>) command-line: note: in included file: builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined builtin:0:0: sparse: this was the original definition builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined builtin:0:0: sparse: this was the original definition fs/ext4/mballoc.c:994:9: sparse: sparse: context imbalance in 'ext4_mb_choose_next_group_cr1' - wrong count at exit fs/ext4/mballoc.c:1264:9: sparse: sparse: context imbalance in 'ext4_mb_init_cache' - different lock contexts for basic block fs/ext4/mballoc.c:2168:5: sparse: sparse: context imbalance in 'ext4_mb_try_best_found' - different lock contexts for basic block fs/ext4/mballoc.c:2196:5: sparse: sparse: context imbalance in 'ext4_mb_find_by_goal' - different lock contexts for basic block fs/ext4/mballoc.c:2483:12: sparse: sparse: context imbalance in 'ext4_mb_good_group_nolock' - wrong count at exit fs/ext4/mballoc.c:2698:87: sparse: sparse: context imbalance in 'ext4_mb_regular_allocator' - different lock contexts for basic block fs/ext4/mballoc.c:2972:13: sparse: sparse: context imbalance in 'ext4_mb_seq_structs_summary_start' - wrong count at exit fs/ext4/mballoc.c:3044:13: sparse: sparse: context imbalance in 'ext4_mb_seq_structs_summary_stop' - unexpected unlock >> fs/ext4/mballoc.c:3333:9: sparse: sparse: context imbalance in 'ext4_discard_work' - different lock contexts for basic block fs/ext4/mballoc.c:3542:17: sparse: sparse: context imbalance in 'ext4_mb_release' - different lock contexts for basic block fs/ext4/mballoc.c:3662:26: sparse: sparse: context imbalance in 'ext4_free_data_in_buddy' - wrong count at exit fs/ext4/mballoc.c:3873:15: sparse: sparse: context imbalance in 'ext4_mb_mark_diskspace_used' - different lock contexts for basic block fs/ext4/mballoc.c:3881:6: sparse: sparse: context imbalance in 'ext4_mb_mark_bb' - different lock contexts for basic block fs/ext4/mballoc.c:4203:13: sparse: sparse: context imbalance in 'ext4_discard_allocated_blocks' - different lock contexts for basic block fs/ext4/mballoc.c:4505:13: sparse: sparse: context imbalance in 'ext4_mb_put_pa' - different lock contexts for basic block fs/ext4/mballoc.c:4842:9: sparse: sparse: context imbalance in 'ext4_mb_discard_group_preallocations' - different lock contexts for basic block fs/ext4/mballoc.c:4995:9: sparse: sparse: context imbalance in 'ext4_discard_preallocations' - different lock contexts for basic block fs/ext4/mballoc.c:5062:9: sparse: sparse: context imbalance in 'ext4_mb_show_ac' - different lock contexts for basic block fs/ext4/mballoc.c:5290:9: sparse: sparse: context imbalance in 'ext4_mb_discard_lg_preallocations' - different lock contexts for basic block fs/ext4/mballoc.c:5062:9: sparse: sparse: context imbalance in 'ext4_mb_new_blocks' - different lock contexts for basic block fs/ext4/mballoc.c:5935:9: sparse: sparse: context imbalance in 'ext4_free_blocks' - different lock contexts for basic block fs/ext4/mballoc.c:6235:15: sparse: sparse: context imbalance in 'ext4_group_add_blocks' - different lock contexts for basic block fs/ext4/mballoc.c:6275:24: sparse: sparse: context imbalance in 'ext4_trim_extent' - wrong count at exit fs/ext4/mballoc.c:6325:9: sparse: sparse: context imbalance in 'ext4_try_to_trim_range' - different lock contexts for basic block fs/ext4/mballoc.c:6342:1: sparse: sparse: context imbalance in 'ext4_trim_all_free' - different lock contexts for basic block fs/ext4/mballoc.c:6471:1: sparse: sparse: context imbalance in 'ext4_mballoc_query_range' - different lock contexts for basic block vim +/ext4_discard_work +3333 fs/ext4/mballoc.c 2892c15ddda6a7 Eric Sandeen 2011-02-12 3315 c1714c046fe748 Wang Jianchao 2021-07-24 3316 static void ext4_discard_work(struct work_struct *work) c1714c046fe748 Wang Jianchao 2021-07-24 3317 { c1714c046fe748 Wang Jianchao 2021-07-24 3318 struct ext4_sb_info *sbi = container_of(work, c1714c046fe748 Wang Jianchao 2021-07-24 3319 struct ext4_sb_info, s_discard_work); c1714c046fe748 Wang Jianchao 2021-07-24 3320 struct super_block *sb = sbi->s_sb; c1714c046fe748 Wang Jianchao 2021-07-24 3321 struct ext4_free_data *fd, *nfd; c1714c046fe748 Wang Jianchao 2021-07-24 3322 struct ext4_buddy e4b; c1714c046fe748 Wang Jianchao 2021-07-24 3323 struct list_head discard_list; c1714c046fe748 Wang Jianchao 2021-07-24 3324 ext4_group_t grp, load_grp; c1714c046fe748 Wang Jianchao 2021-07-24 3325 int err = 0; c1714c046fe748 Wang Jianchao 2021-07-24 3326 c1714c046fe748 Wang Jianchao 2021-07-24 3327 INIT_LIST_HEAD(&discard_list); c1714c046fe748 Wang Jianchao 2021-07-24 3328 spin_lock(&sbi->s_md_lock); c1714c046fe748 Wang Jianchao 2021-07-24 3329 list_splice_init(&sbi->s_discard_list, &discard_list); c1714c046fe748 Wang Jianchao 2021-07-24 3330 spin_unlock(&sbi->s_md_lock); c1714c046fe748 Wang Jianchao 2021-07-24 3331 c1714c046fe748 Wang Jianchao 2021-07-24 3332 load_grp = UINT_MAX; c1714c046fe748 Wang Jianchao 2021-07-24 @3333 list_for_each_entry_safe(fd, nfd, &discard_list, efd_list) { c1714c046fe748 Wang Jianchao 2021-07-24 3334 /* c1714c046fe748 Wang Jianchao 2021-07-24 3335 * If filesystem is umounting or no memory, give up the discard c1714c046fe748 Wang Jianchao 2021-07-24 3336 */ c1714c046fe748 Wang Jianchao 2021-07-24 3337 if ((sb->s_flags & SB_ACTIVE) && !err) { c1714c046fe748 Wang Jianchao 2021-07-24 3338 grp = fd->efd_group; c1714c046fe748 Wang Jianchao 2021-07-24 3339 if (grp != load_grp) { c1714c046fe748 Wang Jianchao 2021-07-24 3340 if (load_grp != UINT_MAX) c1714c046fe748 Wang Jianchao 2021-07-24 3341 ext4_mb_unload_buddy(&e4b); c1714c046fe748 Wang Jianchao 2021-07-24 3342 c1714c046fe748 Wang Jianchao 2021-07-24 3343 err = ext4_mb_load_buddy(sb, grp, &e4b); c1714c046fe748 Wang Jianchao 2021-07-24 3344 if (err) { c1714c046fe748 Wang Jianchao 2021-07-24 3345 kmem_cache_free(ext4_free_data_cachep, fd); c1714c046fe748 Wang Jianchao 2021-07-24 3346 load_grp = UINT_MAX; c1714c046fe748 Wang Jianchao 2021-07-24 3347 continue; c1714c046fe748 Wang Jianchao 2021-07-24 3348 } else { c1714c046fe748 Wang Jianchao 2021-07-24 3349 load_grp = grp; c1714c046fe748 Wang Jianchao 2021-07-24 3350 } c1714c046fe748 Wang Jianchao 2021-07-24 3351 } c1714c046fe748 Wang Jianchao 2021-07-24 3352 c1714c046fe748 Wang Jianchao 2021-07-24 3353 ext4_lock_group(sb, grp); c1714c046fe748 Wang Jianchao 2021-07-24 3354 ext4_try_to_trim_range(sb, &e4b, fd->efd_start_cluster, c1714c046fe748 Wang Jianchao 2021-07-24 3355 fd->efd_start_cluster + fd->efd_count - 1, 1); c1714c046fe748 Wang Jianchao 2021-07-24 3356 ext4_unlock_group(sb, grp); c1714c046fe748 Wang Jianchao 2021-07-24 3357 } c1714c046fe748 Wang Jianchao 2021-07-24 3358 kmem_cache_free(ext4_free_data_cachep, fd); c1714c046fe748 Wang Jianchao 2021-07-24 3359 } c1714c046fe748 Wang Jianchao 2021-07-24 3360 c1714c046fe748 Wang Jianchao 2021-07-24 3361 if (load_grp != UINT_MAX) c1714c046fe748 Wang Jianchao 2021-07-24 3362 ext4_mb_unload_buddy(&e4b); c1714c046fe748 Wang Jianchao 2021-07-24 3363 } c1714c046fe748 Wang Jianchao 2021-07-24 3364 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org