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-20221206] [cannot apply to linus/master v6.1-rc8] [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/Qu-Wenruo/btrfs-scrub-rework-to-get-rid-of-the-complex-bio-formshaping/20221206-162558 base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next patch link: https://lore.kernel.org/r/633a0a4c44723cf193962e012530da4591d9b7a9.1670314744.git.wqu%40suse.com patch subject: [PoC PATCH 06/11] btrfs: scrub: add the error reporting for scrub2_stripe config: arm64-randconfig-r014-20221206 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6e4cea55f0d1104408b26ac574566a0e4de48036) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/eb73e58948022f98a2636933e62f3765d6858db3 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Qu-Wenruo/btrfs-scrub-rework-to-get-rid-of-the-complex-bio-formshaping/20221206-162558 git checkout eb73e58948022f98a2636933e62f3765d6858db3 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash fs/btrfs/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> fs/btrfs/scrub.c:4109:6: warning: variable 'nr_nodatacsum_sectors' set but not used [-Wunused-but-set-variable] int nr_nodatacsum_sectors = 0; ^ 1 warning generated. vim +/nr_nodatacsum_sectors +4109 fs/btrfs/scrub.c 4098 4099 void scrub2_report_errors(struct scrub_ctx *sctx, 4100 struct scrub2_stripe *stripe) 4101 { 4102 static DEFINE_RATELIMIT_STATE(rs, DEFAULT_RATELIMIT_INTERVAL, 4103 DEFAULT_RATELIMIT_BURST); 4104 struct btrfs_fs_info *fs_info = sctx->fs_info; 4105 struct btrfs_device *dev = NULL; 4106 u64 physical = 0; 4107 int nr_data_sectors = 0; 4108 int nr_meta_sectors = 0; > 4109 int nr_nodatacsum_sectors = 0; 4110 int nr_repaired_sectors = 0; 4111 int sector_nr; 4112 4113 /* 4114 * Init needed infos for error reporting, as although our scrub2 4115 * infrastucture is all based on btrfs_submit_bio() thus no need for 4116 * dev/physical. 4117 * 4118 * But our error reporting system still needs dev and physical. 4119 */ 4120 if (!bitmap_empty(&stripe->init_error_bitmap, stripe->nr_sectors)) { 4121 u64 mapped_len = fs_info->sectorsize; 4122 struct btrfs_io_context *bioc = NULL; 4123 int stripe_index = stripe->mirror_num - 1; 4124 int ret; 4125 4126 /* For scrub, our mirror_num should always start at 1. */ 4127 ASSERT(stripe->mirror_num >= 1); 4128 ret = btrfs_map_sblock(fs_info, BTRFS_MAP_GET_READ_MIRRORS, 4129 stripe->logical, &mapped_len, &bioc); 4130 /* 4131 * If we failed, sblock->sctx will be NULL, and later detailed 4132 * reports will just be skipped. 4133 */ 4134 if (ret < 0) 4135 goto skip; 4136 physical = bioc->stripes[stripe_index].physical; 4137 dev = bioc->stripes[stripe_index].dev; 4138 btrfs_put_bioc(bioc); 4139 } 4140 4141 skip: 4142 for_each_set_bit(sector_nr, &stripe->used_sector_bitmap, 4143 stripe->nr_sectors) { 4144 bool repaired = false; 4145 4146 if (stripe->sectors[sector_nr].is_metadata) { 4147 nr_meta_sectors++; 4148 } else { 4149 nr_data_sectors++; 4150 if (!stripe->sectors[sector_nr].csum) 4151 nr_nodatacsum_sectors++; 4152 } 4153 4154 if (test_bit(sector_nr, &stripe->init_error_bitmap) && 4155 !test_bit(sector_nr, &stripe->current_error_bitmap)) { 4156 nr_repaired_sectors++; 4157 repaired = true; 4158 } 4159 4160 /* Good sector from the beginning, nothing need to be done. */ 4161 if (!test_bit(sector_nr, &stripe->init_error_bitmap)) 4162 continue; 4163 4164 /* 4165 * Report error for the corrupted sectors. 4166 * If repaired, just output the message of repaired message. 4167 */ 4168 if (repaired) { 4169 if (dev) 4170 btrfs_err_rl_in_rcu(fs_info, 4171 "fixed up error at logical %llu on dev %s physical %llu", 4172 stripe->logical, btrfs_dev_name(dev), 4173 physical); 4174 else 4175 btrfs_err_rl_in_rcu(fs_info, 4176 "fixed up error at logical %llu on mirror %u", 4177 stripe->logical, stripe->mirror_num); 4178 continue; 4179 } 4180 4181 /* The remaining are all for unrepaired. */ 4182 if (dev) 4183 btrfs_err_rl_in_rcu(fs_info, 4184 "unable to fixup (regular) error at logical %llu on dev %s physical %llu", 4185 stripe->logical, btrfs_dev_name(dev), 4186 physical); 4187 else 4188 btrfs_err_rl_in_rcu(fs_info, 4189 "unable to fixup (regular) error at logical %llu on mirror %u", 4190 stripe->logical, stripe->mirror_num); 4191 4192 if (test_bit(sector_nr, &stripe->io_error_bitmap)) 4193 if (__ratelimit(&rs) && dev) 4194 scrub2_print_warning("i/o error", dev, false, 4195 stripe->logical, physical); 4196 if (test_bit(sector_nr, &stripe->csum_error_bitmap)) 4197 if (__ratelimit(&rs) && dev) 4198 scrub2_print_warning("checksum error", dev, false, 4199 stripe->logical, physical); 4200 if (test_bit(sector_nr, &stripe->meta_error_bitmap)) 4201 if (__ratelimit(&rs) && dev) 4202 scrub2_print_warning("header error", dev, false, 4203 stripe->logical, physical); 4204 } 4205 4206 spin_lock(&sctx->stat_lock); 4207 sctx->stat.data_extents_scrubbed += stripe->nr_data_extents; 4208 sctx->stat.tree_extents_scrubbed += stripe->nr_meta_extents; 4209 sctx->stat.data_bytes_scrubbed += nr_data_sectors << 4210 fs_info->sectorsize_bits; 4211 sctx->stat.tree_bytes_scrubbed += nr_meta_sectors << 4212 fs_info->sectorsize_bits; 4213 sctx->stat.read_errors += 4214 bitmap_weight(&stripe->io_error_bitmap, stripe->nr_sectors); 4215 sctx->stat.csum_errors += 4216 bitmap_weight(&stripe->csum_error_bitmap, stripe->nr_sectors); 4217 sctx->stat.verify_errors += 4218 bitmap_weight(&stripe->meta_error_bitmap, stripe->nr_sectors); 4219 sctx->stat.uncorrectable_errors += 4220 bitmap_weight(&stripe->current_error_bitmap, stripe->nr_sectors); 4221 sctx->stat.corrected_errors += nr_repaired_sectors; 4222 spin_unlock(&sctx->stat_lock); 4223 } 4224 -- 0-DAY CI Kernel Test Service https://01.org/lkp