public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev
Subject: Re: [PATCH 7/8] btrfs: use a dedicated data structure for chunk maps
Date: Wed, 22 Nov 2023 05:25:47 +0800	[thread overview]
Message-ID: <202311220419.PQxS7GUc-lkp@intel.com> (raw)
In-Reply-To: <777320fd09dfc68a89180723bf5d7368dab06299.1700573314.git.fdmanana@suse.com>

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on linus/master v6.7-rc2 next-20231121]
[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/fdmanana-kernel-org/btrfs-fix-off-by-one-when-checking-chunk-map-includes-logical-address/20231121-214139
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
patch link:    https://lore.kernel.org/r/777320fd09dfc68a89180723bf5d7368dab06299.1700573314.git.fdmanana%40suse.com
patch subject: [PATCH 7/8] btrfs: use a dedicated data structure for chunk maps
config: i386-randconfig-061-20231122 (https://download.01.org/0day-ci/archive/20231122/202311220419.PQxS7GUc-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231122/202311220419.PQxS7GUc-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311220419.PQxS7GUc-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/btrfs/zoned.c:1293:12: warning: declaration of 'struct map_lookup' will not be visible outside of this function [-Wvisibility]
                                   struct map_lookup *map)
                                          ^
   fs/btrfs/zoned.c:1296:35: error: incomplete definition of type 'struct map_lookup'
           struct btrfs_device *device = map->stripes[zone_idx].dev;
                                         ~~~^
   fs/btrfs/zoned.c:1293:12: note: forward declaration of 'struct map_lookup'
                                   struct map_lookup *map)
                                          ^
   fs/btrfs/zoned.c:1302:22: error: incomplete definition of type 'struct map_lookup'
           info->physical = map->stripes[zone_idx].physical;
                            ~~~^
   fs/btrfs/zoned.c:1293:12: note: forward declaration of 'struct map_lookup'
                                   struct map_lookup *map)
                                          ^
   fs/btrfs/zoned.c:1396:18: warning: declaration of 'struct map_lookup' will not be visible outside of this function [-Wvisibility]
                                         struct map_lookup *map,
                                                ^
   fs/btrfs/zoned.c:1402:10: error: incomplete definition of type 'struct map_lookup'
           if ((map->type & BTRFS_BLOCK_GROUP_DATA) && !fs_info->stripe_root) {
                ~~~^
   fs/btrfs/zoned.c:1396:18: note: forward declaration of 'struct map_lookup'
                                         struct map_lookup *map,
                                                ^
   fs/btrfs/zoned.c:1438:13: warning: declaration of 'struct map_lookup' will not be visible outside of this function [-Wvisibility]
                                           struct map_lookup *map,
                                                  ^
   fs/btrfs/zoned.c:1445:10: error: incomplete definition of type 'struct map_lookup'
           if ((map->type & BTRFS_BLOCK_GROUP_DATA) && !fs_info->stripe_root) {
                ~~~^
   fs/btrfs/zoned.c:1438:13: note: forward declaration of 'struct map_lookup'
                                           struct map_lookup *map,
                                                  ^
   fs/btrfs/zoned.c:1447:36: error: incomplete definition of type 'struct map_lookup'
                             btrfs_bg_type_to_raid_name(map->type));
                                                        ~~~^
   fs/btrfs/messages.h:46:40: note: expanded from macro 'btrfs_err'
           btrfs_printk(fs_info, KERN_ERR fmt, ##args)
                                                 ^~~~
   fs/btrfs/messages.h:27:32: note: expanded from macro 'btrfs_printk'
           _btrfs_printk(fs_info, fmt, ##args)
                                         ^~~~
   fs/btrfs/zoned.c:1438:13: note: forward declaration of 'struct map_lookup'
                                           struct map_lookup *map,
                                                  ^
   fs/btrfs/zoned.c:1451:21: error: incomplete definition of type 'struct map_lookup'
           for (i = 0; i < map->num_stripes; i++) {
                           ~~~^
   fs/btrfs/zoned.c:1438:13: note: forward declaration of 'struct map_lookup'
                                           struct map_lookup *map,
                                                  ^
   fs/btrfs/zoned.c:1460:37: error: incomplete definition of type 'struct map_lookup'
                                     btrfs_bg_type_to_raid_name(map->type));
                                                                ~~~^
   fs/btrfs/messages.h:46:40: note: expanded from macro 'btrfs_err'
           btrfs_printk(fs_info, KERN_ERR fmt, ##args)
                                                 ^~~~
   fs/btrfs/messages.h:27:32: note: expanded from macro 'btrfs_printk'
           _btrfs_printk(fs_info, fmt, ##args)
                                         ^~~~
   fs/btrfs/zoned.c:1438:13: note: forward declaration of 'struct map_lookup'
                                           struct map_lookup *map,
                                                  ^
   fs/btrfs/zoned.c:1486:13: warning: declaration of 'struct map_lookup' will not be visible outside of this function [-Wvisibility]
                                           struct map_lookup *map,
                                                  ^
   fs/btrfs/zoned.c:1492:10: error: incomplete definition of type 'struct map_lookup'
           if ((map->type & BTRFS_BLOCK_GROUP_DATA) && !fs_info->stripe_root) {
                ~~~^
   fs/btrfs/zoned.c:1486:13: note: forward declaration of 'struct map_lookup'
                                           struct map_lookup *map,
                                                  ^
   fs/btrfs/zoned.c:1494:36: error: incomplete definition of type 'struct map_lookup'
                             btrfs_bg_type_to_raid_name(map->type));
                                                        ~~~^
   fs/btrfs/messages.h:46:40: note: expanded from macro 'btrfs_err'
           btrfs_printk(fs_info, KERN_ERR fmt, ##args)
                                                 ^~~~
   fs/btrfs/messages.h:27:32: note: expanded from macro 'btrfs_printk'
           _btrfs_printk(fs_info, fmt, ##args)
                                         ^~~~
   fs/btrfs/zoned.c:1486:13: note: forward declaration of 'struct map_lookup'
                                           struct map_lookup *map,
                                                  ^
   fs/btrfs/zoned.c:1498:25: error: incomplete definition of type 'struct map_lookup'
           for (int i = 0; i < map->num_stripes; i++) {
                               ~~~^
   fs/btrfs/zoned.c:1486:13: note: forward declaration of 'struct map_lookup'
                                           struct map_lookup *map,
                                                  ^
   fs/btrfs/zoned.c:1518:14: warning: declaration of 'struct map_lookup' will not be visible outside of this function [-Wvisibility]
                                            struct map_lookup *map,
                                                   ^
   fs/btrfs/zoned.c:1524:10: error: incomplete definition of type 'struct map_lookup'
           if ((map->type & BTRFS_BLOCK_GROUP_DATA) && !fs_info->stripe_root) {
                ~~~^
   fs/btrfs/zoned.c:1518:14: note: forward declaration of 'struct map_lookup'
                                            struct map_lookup *map,
                                                   ^
   fs/btrfs/zoned.c:1526:36: error: incomplete definition of type 'struct map_lookup'
                             btrfs_bg_type_to_raid_name(map->type));


vim +1293 fs/btrfs/zoned.c

15c12fcc50a1b12 Christoph Hellwig 2023-06-05  1290  
09a46725cc84165 Christoph Hellwig 2023-06-05  1291  static int btrfs_load_zone_info(struct btrfs_fs_info *fs_info, int zone_idx,
09a46725cc84165 Christoph Hellwig 2023-06-05  1292  				struct zone_info *info, unsigned long *active,
09a46725cc84165 Christoph Hellwig 2023-06-05 @1293  				struct map_lookup *map)
09a46725cc84165 Christoph Hellwig 2023-06-05  1294  {
09a46725cc84165 Christoph Hellwig 2023-06-05  1295  	struct btrfs_dev_replace *dev_replace = &fs_info->dev_replace;
09a46725cc84165 Christoph Hellwig 2023-06-05  1296  	struct btrfs_device *device = map->stripes[zone_idx].dev;
09a46725cc84165 Christoph Hellwig 2023-06-05  1297  	int dev_replace_is_ongoing = 0;
09a46725cc84165 Christoph Hellwig 2023-06-05  1298  	unsigned int nofs_flag;
09a46725cc84165 Christoph Hellwig 2023-06-05  1299  	struct blk_zone zone;
09a46725cc84165 Christoph Hellwig 2023-06-05  1300  	int ret;
09a46725cc84165 Christoph Hellwig 2023-06-05  1301  
09a46725cc84165 Christoph Hellwig 2023-06-05  1302  	info->physical = map->stripes[zone_idx].physical;
09a46725cc84165 Christoph Hellwig 2023-06-05  1303  
09a46725cc84165 Christoph Hellwig 2023-06-05  1304  	if (!device->bdev) {
09a46725cc84165 Christoph Hellwig 2023-06-05  1305  		info->alloc_offset = WP_MISSING_DEV;
09a46725cc84165 Christoph Hellwig 2023-06-05  1306  		return 0;
09a46725cc84165 Christoph Hellwig 2023-06-05  1307  	}
09a46725cc84165 Christoph Hellwig 2023-06-05  1308  
09a46725cc84165 Christoph Hellwig 2023-06-05  1309  	/* Consider a zone as active if we can allow any number of active zones. */
09a46725cc84165 Christoph Hellwig 2023-06-05  1310  	if (!device->zone_info->max_active_zones)
09a46725cc84165 Christoph Hellwig 2023-06-05  1311  		__set_bit(zone_idx, active);
09a46725cc84165 Christoph Hellwig 2023-06-05  1312  
09a46725cc84165 Christoph Hellwig 2023-06-05  1313  	if (!btrfs_dev_is_sequential(device, info->physical)) {
09a46725cc84165 Christoph Hellwig 2023-06-05  1314  		info->alloc_offset = WP_CONVENTIONAL;
09a46725cc84165 Christoph Hellwig 2023-06-05  1315  		return 0;
09a46725cc84165 Christoph Hellwig 2023-06-05  1316  	}
09a46725cc84165 Christoph Hellwig 2023-06-05  1317  
09a46725cc84165 Christoph Hellwig 2023-06-05  1318  	/* This zone will be used for allocation, so mark this zone non-empty. */
09a46725cc84165 Christoph Hellwig 2023-06-05  1319  	btrfs_dev_clear_zone_empty(device, info->physical);
09a46725cc84165 Christoph Hellwig 2023-06-05  1320  
09a46725cc84165 Christoph Hellwig 2023-06-05  1321  	down_read(&dev_replace->rwsem);
09a46725cc84165 Christoph Hellwig 2023-06-05  1322  	dev_replace_is_ongoing = btrfs_dev_replace_is_ongoing(dev_replace);
09a46725cc84165 Christoph Hellwig 2023-06-05  1323  	if (dev_replace_is_ongoing && dev_replace->tgtdev != NULL)
09a46725cc84165 Christoph Hellwig 2023-06-05  1324  		btrfs_dev_clear_zone_empty(dev_replace->tgtdev, info->physical);
09a46725cc84165 Christoph Hellwig 2023-06-05  1325  	up_read(&dev_replace->rwsem);
09a46725cc84165 Christoph Hellwig 2023-06-05  1326  
09a46725cc84165 Christoph Hellwig 2023-06-05  1327  	/*
09a46725cc84165 Christoph Hellwig 2023-06-05  1328  	 * The group is mapped to a sequential zone. Get the zone write pointer
09a46725cc84165 Christoph Hellwig 2023-06-05  1329  	 * to determine the allocation offset within the zone.
09a46725cc84165 Christoph Hellwig 2023-06-05  1330  	 */
09a46725cc84165 Christoph Hellwig 2023-06-05  1331  	WARN_ON(!IS_ALIGNED(info->physical, fs_info->zone_size));
09a46725cc84165 Christoph Hellwig 2023-06-05  1332  	nofs_flag = memalloc_nofs_save();
09a46725cc84165 Christoph Hellwig 2023-06-05  1333  	ret = btrfs_get_dev_zone(device, info->physical, &zone);
09a46725cc84165 Christoph Hellwig 2023-06-05  1334  	memalloc_nofs_restore(nofs_flag);
09a46725cc84165 Christoph Hellwig 2023-06-05  1335  	if (ret) {
09a46725cc84165 Christoph Hellwig 2023-06-05  1336  		if (ret != -EIO && ret != -EOPNOTSUPP)
09a46725cc84165 Christoph Hellwig 2023-06-05  1337  			return ret;
09a46725cc84165 Christoph Hellwig 2023-06-05  1338  		info->alloc_offset = WP_MISSING_DEV;
09a46725cc84165 Christoph Hellwig 2023-06-05  1339  		return 0;
09a46725cc84165 Christoph Hellwig 2023-06-05  1340  	}
09a46725cc84165 Christoph Hellwig 2023-06-05  1341  
09a46725cc84165 Christoph Hellwig 2023-06-05  1342  	if (zone.type == BLK_ZONE_TYPE_CONVENTIONAL) {
09a46725cc84165 Christoph Hellwig 2023-06-05  1343  		btrfs_err_in_rcu(fs_info,
09a46725cc84165 Christoph Hellwig 2023-06-05  1344  		"zoned: unexpected conventional zone %llu on device %s (devid %llu)",
09a46725cc84165 Christoph Hellwig 2023-06-05  1345  			zone.start << SECTOR_SHIFT, rcu_str_deref(device->name),
09a46725cc84165 Christoph Hellwig 2023-06-05  1346  			device->devid);
09a46725cc84165 Christoph Hellwig 2023-06-05  1347  		return -EIO;
09a46725cc84165 Christoph Hellwig 2023-06-05  1348  	}
09a46725cc84165 Christoph Hellwig 2023-06-05  1349  
09a46725cc84165 Christoph Hellwig 2023-06-05  1350  	info->capacity = (zone.capacity << SECTOR_SHIFT);
09a46725cc84165 Christoph Hellwig 2023-06-05  1351  
09a46725cc84165 Christoph Hellwig 2023-06-05  1352  	switch (zone.cond) {
09a46725cc84165 Christoph Hellwig 2023-06-05  1353  	case BLK_ZONE_COND_OFFLINE:
09a46725cc84165 Christoph Hellwig 2023-06-05  1354  	case BLK_ZONE_COND_READONLY:
09a46725cc84165 Christoph Hellwig 2023-06-05  1355  		btrfs_err(fs_info,
09a46725cc84165 Christoph Hellwig 2023-06-05  1356  		"zoned: offline/readonly zone %llu on device %s (devid %llu)",
09a46725cc84165 Christoph Hellwig 2023-06-05  1357  			  (info->physical >> device->zone_info->zone_size_shift),
09a46725cc84165 Christoph Hellwig 2023-06-05  1358  			  rcu_str_deref(device->name), device->devid);
09a46725cc84165 Christoph Hellwig 2023-06-05  1359  		info->alloc_offset = WP_MISSING_DEV;
09a46725cc84165 Christoph Hellwig 2023-06-05  1360  		break;
09a46725cc84165 Christoph Hellwig 2023-06-05  1361  	case BLK_ZONE_COND_EMPTY:
09a46725cc84165 Christoph Hellwig 2023-06-05  1362  		info->alloc_offset = 0;
09a46725cc84165 Christoph Hellwig 2023-06-05  1363  		break;
09a46725cc84165 Christoph Hellwig 2023-06-05  1364  	case BLK_ZONE_COND_FULL:
09a46725cc84165 Christoph Hellwig 2023-06-05  1365  		info->alloc_offset = info->capacity;
09a46725cc84165 Christoph Hellwig 2023-06-05  1366  		break;
09a46725cc84165 Christoph Hellwig 2023-06-05  1367  	default:
09a46725cc84165 Christoph Hellwig 2023-06-05  1368  		/* Partially used zone. */
09a46725cc84165 Christoph Hellwig 2023-06-05  1369  		info->alloc_offset = ((zone.wp - zone.start) << SECTOR_SHIFT);
09a46725cc84165 Christoph Hellwig 2023-06-05  1370  		__set_bit(zone_idx, active);
09a46725cc84165 Christoph Hellwig 2023-06-05  1371  		break;
09a46725cc84165 Christoph Hellwig 2023-06-05  1372  	}
09a46725cc84165 Christoph Hellwig 2023-06-05  1373  
09a46725cc84165 Christoph Hellwig 2023-06-05  1374  	return 0;
09a46725cc84165 Christoph Hellwig 2023-06-05  1375  }
09a46725cc84165 Christoph Hellwig 2023-06-05  1376  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

  parent reply	other threads:[~2023-11-21 21:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 13:38 [PATCH 0/8] btrfs: add a btrfs_chunk_map structure and preparatory cleanups fdmanana
2023-11-21 13:38 ` [PATCH 1/8] btrfs: fix off-by-one when checking chunk map includes logical address fdmanana
2023-11-21 13:38 ` [PATCH 2/8] btrfs: make error messages more clear when getting a chunk map fdmanana
2023-11-21 13:38 ` [PATCH 3/8] btrfs: mark sanity checks when getting chunk map as unlikely fdmanana
2023-11-21 13:38 ` [PATCH 4/8] btrfs: split assert into two different asserts when removing block group fdmanana
2023-11-21 13:38 ` [PATCH 5/8] btrfs: unexport extent_map_block_end() fdmanana
2023-11-21 13:38 ` [PATCH 6/8] btrfs: use btrfs_next_item() at scrub.c:find_first_extent_item() fdmanana
2023-11-21 13:38 ` [PATCH 7/8] btrfs: use a dedicated data structure for chunk maps fdmanana
2023-11-21 15:19   ` David Sterba
2023-11-21 16:50     ` Filipe Manana
2023-11-21 18:08       ` David Sterba
2023-11-21 18:23   ` David Sterba
2023-11-22 11:32     ` Filipe Manana
2023-11-22 14:16       ` David Sterba
2023-11-21 21:25   ` kernel test robot [this message]
2023-11-21 13:38 ` [PATCH 8/8] btrfs: remove stripe size local variable from insert_dev_extents() fdmanana
2023-11-21 14:12 ` [PATCH 0/8] btrfs: add a btrfs_chunk_map structure and preparatory cleanups Josef Bacik
2023-11-21 21:03 ` David Sterba

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=202311220419.PQxS7GUc-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox