llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH PoC 9/9] btrfs: scrub: implement recoverable sectors report for scrub_fs
       [not found] <06e4f67a9e50c2b6dfc49a086ee62053cbdcc0ae.1662191784.git.wqu@suse.com>
@ 2022-09-03 11:22 ` kernel test robot
  2022-09-03 11:33 ` kernel test robot
  1 sibling, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-09-03 11:22 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs; +Cc: llvm, kbuild-all

Hi Qu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on linus/master v6.0-rc3 next-20220901]
[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-introduce-a-new-family-of-ioctl-scrub_fs/20220903-162128
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: arm-randconfig-r032-20220903 (https://download.01.org/0day-ci/archive/20220903/202209031950.mB6jb2hL-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project c55b41d5199d2394dd6cdb8f52180d8b81d809d4)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/e6387ecfd7e78ac47fca972ef76f3286e6cd3900
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Qu-Wenruo/btrfs-scrub-introduce-a-new-family-of-ioctl-scrub_fs/20220903-162128
        git checkout e6387ecfd7e78ac47fca972ef76f3286e6cd3900
        # 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=arm SHELL=/bin/bash fs/btrfs/

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

All warnings (new ones prefixed by >>):

>> fs/btrfs/scrub.c:5382:6: warning: variable 'nr_good' set but not used [-Wunused-but-set-variable]
           int nr_good = 0;
               ^
   1 warning generated.


vim +/nr_good +5382 fs/btrfs/scrub.c

  5376	
  5377	static void scrub_fs_recover_data(struct scrub_fs_ctx *sfctx, int sector_nr)
  5378	{
  5379		struct btrfs_fs_info *fs_info = sfctx->fs_info;
  5380		const bool has_csum = !!sfctx->sectors[sector_nr].csum;
  5381		bool mismatch_found = false;
> 5382		int nr_good = 0;
  5383		int io_fail = 0;
  5384		int mirror_nr;
  5385	
  5386		for (mirror_nr = 0; mirror_nr < sfctx->nr_copies; mirror_nr++) {
  5387			struct scrub_fs_sector *sector =
  5388				scrub_fs_get_sector(sfctx, sector_nr, mirror_nr);
  5389	
  5390			if (sector->flags & SCRUB_FS_SECTOR_FLAG_GOOD)
  5391				nr_good++;
  5392			if (!(sector->flags & SCRUB_FS_SECTOR_FLAG_IO_DONE))
  5393				io_fail++;
  5394		}
  5395	
  5396		if (has_csum) {
  5397			/*
  5398			 * There is at least one good copy, thus all the other
  5399			 * corrupted sectors can also be recovered.
  5400			 */
  5401			for (mirror_nr = 0; mirror_nr < sfctx->nr_copies; mirror_nr++) {
  5402				struct scrub_fs_sector *sector =
  5403					scrub_fs_get_sector(sfctx, sector_nr, mirror_nr);
  5404	
  5405				if (sector->flags & SCRUB_FS_SECTOR_FLAG_GOOD)
  5406					continue;
  5407				sector->flags |= SCRUB_FS_SECTOR_FLAG_RECOVERABLE;
  5408				sfctx->stat.data_recoverable += fs_info->sectorsize;
  5409			}
  5410	
  5411			/* Place holder for writeback */
  5412			return;
  5413		}
  5414	
  5415		/*
  5416		 * No datasum case, it's much harder.
  5417		 *
  5418		 * The idea is, we have to compare all the sectors to determine if they
  5419		 * match.
  5420		 *
  5421		 * Firstly rule out sectors which don't have extra working copies.
  5422		 */
  5423		if (sfctx->nr_copies - io_fail <= 1) {
  5424			sfctx->stat.data_nocsum_uncertain += fs_info->sectorsize;
  5425			return;
  5426		}
  5427	
  5428		/*
  5429		 * For now, we can only support one case, all data read matches with each
  5430		 * other, or we consider them all uncertain.
  5431		 */
  5432		for (mirror_nr = 0; mirror_nr < sfctx->nr_copies - 1; mirror_nr++) {
  5433			struct scrub_fs_sector *sector =
  5434				scrub_fs_get_sector(sfctx, sector_nr, mirror_nr);
  5435			struct scrub_fs_sector *next_sector;
  5436			int ret;
  5437	
  5438			/* The first sector has IO error, skip to the next run. */
  5439			if (!(sector->flags & SCRUB_FS_SECTOR_FLAG_IO_DONE))
  5440				continue;
  5441	
  5442			next_sector = scrub_fs_find_next_working_mirror(sfctx,
  5443					sector_nr, mirror_nr);
  5444			/* We're already the last working copy, can break now. */
  5445			if (!next_sector)
  5446				break;
  5447	
  5448			ret = scrub_fs_memcmp_sectors(sfctx, sector, next_sector);
  5449			if (ret)
  5450				mismatch_found = true;
  5451		}
  5452	
  5453		/*
  5454		 * We have found mismatched contents, mark all those sectors
  5455		 * which doesn't have IO error as uncertain.
  5456		 */
  5457		if (mismatch_found)
  5458			sfctx->stat.data_nocsum_uncertain +=
  5459				(sfctx->nr_copies - io_fail) << fs_info->sectorsize_bits;
  5460	}
  5461	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH PoC 9/9] btrfs: scrub: implement recoverable sectors report for scrub_fs
       [not found] <06e4f67a9e50c2b6dfc49a086ee62053cbdcc0ae.1662191784.git.wqu@suse.com>
  2022-09-03 11:22 ` [PATCH PoC 9/9] btrfs: scrub: implement recoverable sectors report for scrub_fs kernel test robot
@ 2022-09-03 11:33 ` kernel test robot
  1 sibling, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-09-03 11:33 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs; +Cc: llvm, kbuild-all

Hi Qu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on linus/master v6.0-rc3 next-20220901]
[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-introduce-a-new-family-of-ioctl-scrub_fs/20220903-162128
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: hexagon-randconfig-r045-20220902 (https://download.01.org/0day-ci/archive/20220903/202209031939.5FTgOh5V-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project c55b41d5199d2394dd6cdb8f52180d8b81d809d4)
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
        # https://github.com/intel-lab-lkp/linux/commit/e6387ecfd7e78ac47fca972ef76f3286e6cd3900
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Qu-Wenruo/btrfs-scrub-introduce-a-new-family-of-ioctl-scrub_fs/20220903-162128
        git checkout e6387ecfd7e78ac47fca972ef76f3286e6cd3900
        # 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=hexagon SHELL=/bin/bash fs/btrfs/

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

All warnings (new ones prefixed by >>):

>> fs/btrfs/scrub.c:5382:6: warning: variable 'nr_good' set but not used [-Wunused-but-set-variable]
           int nr_good = 0;
               ^
   1 warning generated.


vim +/nr_good +5382 fs/btrfs/scrub.c

  5376	
  5377	static void scrub_fs_recover_data(struct scrub_fs_ctx *sfctx, int sector_nr)
  5378	{
  5379		struct btrfs_fs_info *fs_info = sfctx->fs_info;
  5380		const bool has_csum = !!sfctx->sectors[sector_nr].csum;
  5381		bool mismatch_found = false;
> 5382		int nr_good = 0;
  5383		int io_fail = 0;
  5384		int mirror_nr;
  5385	
  5386		for (mirror_nr = 0; mirror_nr < sfctx->nr_copies; mirror_nr++) {
  5387			struct scrub_fs_sector *sector =
  5388				scrub_fs_get_sector(sfctx, sector_nr, mirror_nr);
  5389	
  5390			if (sector->flags & SCRUB_FS_SECTOR_FLAG_GOOD)
  5391				nr_good++;
  5392			if (!(sector->flags & SCRUB_FS_SECTOR_FLAG_IO_DONE))
  5393				io_fail++;
  5394		}
  5395	
  5396		if (has_csum) {
  5397			/*
  5398			 * There is at least one good copy, thus all the other
  5399			 * corrupted sectors can also be recovered.
  5400			 */
  5401			for (mirror_nr = 0; mirror_nr < sfctx->nr_copies; mirror_nr++) {
  5402				struct scrub_fs_sector *sector =
  5403					scrub_fs_get_sector(sfctx, sector_nr, mirror_nr);
  5404	
  5405				if (sector->flags & SCRUB_FS_SECTOR_FLAG_GOOD)
  5406					continue;
  5407				sector->flags |= SCRUB_FS_SECTOR_FLAG_RECOVERABLE;
  5408				sfctx->stat.data_recoverable += fs_info->sectorsize;
  5409			}
  5410	
  5411			/* Place holder for writeback */
  5412			return;
  5413		}
  5414	
  5415		/*
  5416		 * No datasum case, it's much harder.
  5417		 *
  5418		 * The idea is, we have to compare all the sectors to determine if they
  5419		 * match.
  5420		 *
  5421		 * Firstly rule out sectors which don't have extra working copies.
  5422		 */
  5423		if (sfctx->nr_copies - io_fail <= 1) {
  5424			sfctx->stat.data_nocsum_uncertain += fs_info->sectorsize;
  5425			return;
  5426		}
  5427	
  5428		/*
  5429		 * For now, we can only support one case, all data read matches with each
  5430		 * other, or we consider them all uncertain.
  5431		 */
  5432		for (mirror_nr = 0; mirror_nr < sfctx->nr_copies - 1; mirror_nr++) {
  5433			struct scrub_fs_sector *sector =
  5434				scrub_fs_get_sector(sfctx, sector_nr, mirror_nr);
  5435			struct scrub_fs_sector *next_sector;
  5436			int ret;
  5437	
  5438			/* The first sector has IO error, skip to the next run. */
  5439			if (!(sector->flags & SCRUB_FS_SECTOR_FLAG_IO_DONE))
  5440				continue;
  5441	
  5442			next_sector = scrub_fs_find_next_working_mirror(sfctx,
  5443					sector_nr, mirror_nr);
  5444			/* We're already the last working copy, can break now. */
  5445			if (!next_sector)
  5446				break;
  5447	
  5448			ret = scrub_fs_memcmp_sectors(sfctx, sector, next_sector);
  5449			if (ret)
  5450				mismatch_found = true;
  5451		}
  5452	
  5453		/*
  5454		 * We have found mismatched contents, mark all those sectors
  5455		 * which doesn't have IO error as uncertain.
  5456		 */
  5457		if (mismatch_found)
  5458			sfctx->stat.data_nocsum_uncertain +=
  5459				(sfctx->nr_copies - io_fail) << fs_info->sectorsize_bits;
  5460	}
  5461	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-03 11:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <06e4f67a9e50c2b6dfc49a086ee62053cbdcc0ae.1662191784.git.wqu@suse.com>
2022-09-03 11:22 ` [PATCH PoC 9/9] btrfs: scrub: implement recoverable sectors report for scrub_fs kernel test robot
2022-09-03 11:33 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).