All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [kdave-btrfs-devel:for-next-20220307 109/147] fs/btrfs/scrub.c:3121 scrub_raid56_data_stripe_for_parity() error: uninitialized symbol 'ret'.
Date: Tue, 08 Mar 2022 20:44:22 +0800	[thread overview]
Message-ID: <202203082018.Y9FXOl8c-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 10000 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Qu Wenruo <wqu@suse.com>
CC: David Sterba <dsterba@suse.com>

tree:   https://github.com/kdave/btrfs-devel.git for-next-20220307
head:   912dedd70aeb485247c507115704ea7d137d758b
commit: 901eee481de99a9e1620ab449294c3d7608d76c0 [109/147] btrfs: use find_first_extent_item() to replace the open-coded extent item search
:::::: branch date: 21 hours ago
:::::: commit date: 21 hours ago
config: i386-randconfig-m021-20220307 (https://download.01.org/0day-ci/archive/20220308/202203082018.Y9FXOl8c-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
fs/btrfs/scrub.c:3121 scrub_raid56_data_stripe_for_parity() error: uninitialized symbol 'ret'.

Old smatch warnings:
fs/btrfs/scrub.c:3098 scrub_raid56_data_stripe_for_parity() error: we previously assumed 'bioc' could be null (see line 3090)
fs/btrfs/scrub.c:3122 scrub_raid56_data_stripe_for_parity() error: uninitialized symbol 'extent_start'.
fs/btrfs/scrub.c:3123 scrub_raid56_data_stripe_for_parity() error: uninitialized symbol 'extent_size'.
fs/btrfs/scrub.c:3370 scrub_simple_mirror() error: uninitialized symbol 'ret'.

vim +/ret +3121 fs/btrfs/scrub.c

093741d4cda2cb Qu Wenruo     2022-02-18  3021  
80cd926eefca52 Qu Wenruo     2022-02-18  3022  static int scrub_raid56_data_stripe_for_parity(struct scrub_ctx *sctx,
80cd926eefca52 Qu Wenruo     2022-02-18  3023  					       struct scrub_parity *sparity,
5a6ac9eacb4914 Miao Xie      2014-11-06  3024  					       struct map_lookup *map,
5a6ac9eacb4914 Miao Xie      2014-11-06  3025  					       struct btrfs_device *sdev,
80cd926eefca52 Qu Wenruo     2022-02-18  3026  					       struct btrfs_path *path,
80cd926eefca52 Qu Wenruo     2022-02-18  3027  					       u64 logical)
5a6ac9eacb4914 Miao Xie      2014-11-06  3028  {
fb456252d3d9c0 Jeff Mahoney  2016-06-22  3029  	struct btrfs_fs_info *fs_info = sctx->fs_info;
80cd926eefca52 Qu Wenruo     2022-02-18  3030  	struct btrfs_root *extent_root = btrfs_extent_root(fs_info, logical);
80cd926eefca52 Qu Wenruo     2022-02-18  3031  	struct btrfs_root *csum_root = btrfs_csum_root(fs_info, logical);
80cd926eefca52 Qu Wenruo     2022-02-18  3032  	u64 extent_start;
80cd926eefca52 Qu Wenruo     2022-02-18  3033  	u64 extent_size;
901eee481de99a Qu Wenruo     2022-02-18  3034  	u64 cur_logical = logical;
80cd926eefca52 Qu Wenruo     2022-02-18  3035  	int ret;
2522dbe86b54ff Qu Wenruo     2021-12-14  3036  
80cd926eefca52 Qu Wenruo     2022-02-18  3037  	ASSERT(map->type & BTRFS_BLOCK_GROUP_RAID56_MASK);
80cd926eefca52 Qu Wenruo     2022-02-18  3038  	/* Path should not be populated */
80cd926eefca52 Qu Wenruo     2022-02-18  3039  	ASSERT(!path->nodes[0]);
5a6ac9eacb4914 Miao Xie      2014-11-06  3040  
901eee481de99a Qu Wenruo     2022-02-18  3041  	while (cur_logical < logical + map->stripe_len) {
80cd926eefca52 Qu Wenruo     2022-02-18  3042  		struct btrfs_io_context *bioc = NULL;
80cd926eefca52 Qu Wenruo     2022-02-18  3043  		struct btrfs_device *extent_dev;
80cd926eefca52 Qu Wenruo     2022-02-18  3044  		u64 mapped_length;
80cd926eefca52 Qu Wenruo     2022-02-18  3045  		u64 extent_flags;
80cd926eefca52 Qu Wenruo     2022-02-18  3046  		u64 extent_gen;
80cd926eefca52 Qu Wenruo     2022-02-18  3047  		u64 extent_physical;
80cd926eefca52 Qu Wenruo     2022-02-18  3048  		u64 extent_mirror_num;
5a6ac9eacb4914 Miao Xie      2014-11-06  3049  
901eee481de99a Qu Wenruo     2022-02-18  3050  		ret = find_first_extent_item(extent_root, path, cur_logical,
901eee481de99a Qu Wenruo     2022-02-18  3051  					logical + map->stripe_len - cur_logical);
901eee481de99a Qu Wenruo     2022-02-18  3052  		/* No more extent item in this data stripe */
901eee481de99a Qu Wenruo     2022-02-18  3053  		if (ret > 0) {
901eee481de99a Qu Wenruo     2022-02-18  3054  			ret = 0;
5a6ac9eacb4914 Miao Xie      2014-11-06  3055  			break;
5a6ac9eacb4914 Miao Xie      2014-11-06  3056  		}
901eee481de99a Qu Wenruo     2022-02-18  3057  		if (ret < 0)
5a6ac9eacb4914 Miao Xie      2014-11-06  3058  			break;
901eee481de99a Qu Wenruo     2022-02-18  3059  		get_extent_info(path, &extent_start, &extent_size,
901eee481de99a Qu Wenruo     2022-02-18  3060  				&extent_flags, &extent_gen);
5a6ac9eacb4914 Miao Xie      2014-11-06  3061  
901eee481de99a Qu Wenruo     2022-02-18  3062  		/* Metadata should not cross stripe boundaries */
80cd926eefca52 Qu Wenruo     2022-02-18  3063  		if ((extent_flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) &&
901eee481de99a Qu Wenruo     2022-02-18  3064  		    does_range_cross_boundary(extent_start, extent_size,
901eee481de99a Qu Wenruo     2022-02-18  3065  					      logical, map->stripe_len)) {
5d163e0e68ce74 Jeff Mahoney  2016-09-20  3066  			btrfs_err(fs_info,
5d163e0e68ce74 Jeff Mahoney  2016-09-20  3067  	"scrub: tree block %llu spanning stripes, ignored. logical=%llu",
901eee481de99a Qu Wenruo     2022-02-18  3068  				  extent_start, logical);
9799d2c32bef6f Zhao Lei      2015-08-25  3069  			spin_lock(&sctx->stat_lock);
9799d2c32bef6f Zhao Lei      2015-08-25  3070  			sctx->stat.uncorrectable_errors++;
9799d2c32bef6f Zhao Lei      2015-08-25  3071  			spin_unlock(&sctx->stat_lock);
901eee481de99a Qu Wenruo     2022-02-18  3072  			cur_logical += extent_size;
901eee481de99a Qu Wenruo     2022-02-18  3073  			continue;
5a6ac9eacb4914 Miao Xie      2014-11-06  3074  		}
5a6ac9eacb4914 Miao Xie      2014-11-06  3075  
901eee481de99a Qu Wenruo     2022-02-18  3076  		/* Skip hole range which doesn't have any extent */
901eee481de99a Qu Wenruo     2022-02-18  3077  		cur_logical = max(extent_start, cur_logical);
5a6ac9eacb4914 Miao Xie      2014-11-06  3078  
901eee481de99a Qu Wenruo     2022-02-18  3079  		/* Truncate the range inside this data stripe */
901eee481de99a Qu Wenruo     2022-02-18  3080  		extent_size = min(extent_start + extent_size,
901eee481de99a Qu Wenruo     2022-02-18  3081  				  logical + map->stripe_len) - cur_logical;
901eee481de99a Qu Wenruo     2022-02-18  3082  		extent_start = cur_logical;
901eee481de99a Qu Wenruo     2022-02-18  3083  		ASSERT(extent_size <= U32_MAX);
5a6ac9eacb4914 Miao Xie      2014-11-06  3084  
80cd926eefca52 Qu Wenruo     2022-02-18  3085  		scrub_parity_mark_sectors_data(sparity, extent_start, extent_size);
5a6ac9eacb4914 Miao Xie      2014-11-06  3086  
80cd926eefca52 Qu Wenruo     2022-02-18  3087  		mapped_length = extent_size;
80cd926eefca52 Qu Wenruo     2022-02-18  3088  		ret = btrfs_map_block(fs_info, BTRFS_MAP_READ, extent_start,
80cd926eefca52 Qu Wenruo     2022-02-18  3089  				      &mapped_length, &bioc, 0);
80cd926eefca52 Qu Wenruo     2022-02-18  3090  		if (!ret && (!bioc || mapped_length < extent_size))
4a770891d9ddf9 Omar Sandoval 2015-06-19  3091  			ret = -EIO;
4a770891d9ddf9 Omar Sandoval 2015-06-19  3092  		if (ret) {
4c664611791239 Qu Wenruo     2021-09-15  3093  			btrfs_put_bioc(bioc);
80cd926eefca52 Qu Wenruo     2022-02-18  3094  			scrub_parity_mark_sectors_error(sparity, extent_start,
80cd926eefca52 Qu Wenruo     2022-02-18  3095  							extent_size);
80cd926eefca52 Qu Wenruo     2022-02-18  3096  			break;
4a770891d9ddf9 Omar Sandoval 2015-06-19  3097  		}
4c664611791239 Qu Wenruo     2021-09-15  3098  		extent_physical = bioc->stripes[0].physical;
4c664611791239 Qu Wenruo     2021-09-15  3099  		extent_mirror_num = bioc->mirror_num;
4c664611791239 Qu Wenruo     2021-09-15  3100  		extent_dev = bioc->stripes[0].dev;
4c664611791239 Qu Wenruo     2021-09-15  3101  		btrfs_put_bioc(bioc);
5a6ac9eacb4914 Miao Xie      2014-11-06  3102  
80cd926eefca52 Qu Wenruo     2022-02-18  3103  		ret = btrfs_lookup_csums_range(csum_root, extent_start,
80cd926eefca52 Qu Wenruo     2022-02-18  3104  					       extent_start + extent_size - 1,
5a6ac9eacb4914 Miao Xie      2014-11-06  3105  					       &sctx->csum_list, 1);
5a6ac9eacb4914 Miao Xie      2014-11-06  3106  		if (ret)
80cd926eefca52 Qu Wenruo     2022-02-18  3107  			break;
6fa96d72f79a15 Zhao Lei      2015-07-21  3108  
80cd926eefca52 Qu Wenruo     2022-02-18  3109  		ret = scrub_extent_for_parity(sparity, extent_start,
80cd926eefca52 Qu Wenruo     2022-02-18  3110  					      extent_size, extent_physical,
80cd926eefca52 Qu Wenruo     2022-02-18  3111  					      extent_dev, extent_flags,
80cd926eefca52 Qu Wenruo     2022-02-18  3112  					      extent_gen, extent_mirror_num);
6fa96d72f79a15 Zhao Lei      2015-07-21  3113  		scrub_free_csums(sctx);
6fa96d72f79a15 Zhao Lei      2015-07-21  3114  
5a6ac9eacb4914 Miao Xie      2014-11-06  3115  		if (ret)
5a6ac9eacb4914 Miao Xie      2014-11-06  3116  			break;
5a6ac9eacb4914 Miao Xie      2014-11-06  3117  
5a6ac9eacb4914 Miao Xie      2014-11-06  3118  		cond_resched();
901eee481de99a Qu Wenruo     2022-02-18  3119  		cur_logical += extent_size;
5a6ac9eacb4914 Miao Xie      2014-11-06  3120  	}
80cd926eefca52 Qu Wenruo     2022-02-18 @3121  	if (ret < 0)
80cd926eefca52 Qu Wenruo     2022-02-18  3122  		scrub_parity_mark_sectors_error(sparity, extent_start,
80cd926eefca52 Qu Wenruo     2022-02-18  3123  						extent_size);
5a6ac9eacb4914 Miao Xie      2014-11-06  3124  	btrfs_release_path(path);
80cd926eefca52 Qu Wenruo     2022-02-18  3125  	return ret;
80cd926eefca52 Qu Wenruo     2022-02-18  3126  }
5a6ac9eacb4914 Miao Xie      2014-11-06  3127  

:::::: The code@line 3121 was first introduced by commit
:::::: 80cd926eefca522182ee3cf04d8e9984073d34d1 btrfs: refactor scrub_raid56_parity()

:::::: TO: Qu Wenruo <wqu@suse.com>
:::::: CC: David Sterba <dsterba@suse.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

                 reply	other threads:[~2022-03-08 12:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202203082018.Y9FXOl8c-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.