public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Mark Harmstone <maharmstone@fb.com>, linux-btrfs@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Mark Harmstone <maharmstone@fb.com>
Subject: Re: [PATCH 04/12] btrfs: remove remapped block groups from the free-space tree
Date: Fri, 6 Jun 2025 14:41:22 +0800	[thread overview]
Message-ID: <202506061455.6kk5l6Ct-lkp@intel.com> (raw)
In-Reply-To: <20250605162345.2561026-5-maharmstone@fb.com>

Hi Mark,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on linus/master next-20250605]
[cannot apply to v6.15]
[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/Mark-Harmstone/btrfs-add-definitions-and-constants-for-remap-tree/20250606-002804
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
patch link:    https://lore.kernel.org/r/20250605162345.2561026-5-maharmstone%40fb.com
patch subject: [PATCH 04/12] btrfs: remove remapped block groups from the free-space tree
config: i386-randconfig-014-20250606 (https://download.01.org/0day-ci/archive/20250606/202506061455.6kk5l6Ct-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250606/202506061455.6kk5l6Ct-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/202506061455.6kk5l6Ct-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/btrfs/block-group.c:2470:23: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
    2470 |                             !(cache->flags && BTRFS_BLOCK_GROUP_REMAPPED)) {
         |                                            ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/block-group.c:2470:23: note: use '&' for a bitwise operation
    2470 |                             !(cache->flags && BTRFS_BLOCK_GROUP_REMAPPED)) {
         |                                            ^~
         |                                            &
   fs/btrfs/block-group.c:2470:23: note: remove constant to silence this warning
    2470 |                             !(cache->flags && BTRFS_BLOCK_GROUP_REMAPPED)) {
         |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/btrfs/block-group.c:2470:26: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
    2470 |                             !(cache->flags && BTRFS_BLOCK_GROUP_REMAPPED)) {
         |                                               ^
   include/uapi/linux/btrfs_tree.h:1171:47: note: expanded from macro 'BTRFS_BLOCK_GROUP_REMAPPED'
    1171 | #define BTRFS_BLOCK_GROUP_REMAPPED      (1ULL << 11)
         |                                               ^
   2 warnings generated.


vim +2470 fs/btrfs/block-group.c

  2361	
  2362	static int read_one_block_group(struct btrfs_fs_info *info,
  2363					struct btrfs_block_group_item *bgi,
  2364					const struct btrfs_key *key,
  2365					int need_clear)
  2366	{
  2367		struct btrfs_block_group *cache;
  2368		const bool mixed = btrfs_fs_incompat(info, MIXED_GROUPS);
  2369		int ret;
  2370	
  2371		ASSERT(key->type == BTRFS_BLOCK_GROUP_ITEM_KEY);
  2372	
  2373		cache = btrfs_create_block_group_cache(info, key->objectid);
  2374		if (!cache)
  2375			return -ENOMEM;
  2376	
  2377		cache->length = key->offset;
  2378		cache->used = btrfs_stack_block_group_used(bgi);
  2379		cache->commit_used = cache->used;
  2380		cache->flags = btrfs_stack_block_group_flags(bgi);
  2381		cache->global_root_id = btrfs_stack_block_group_chunk_objectid(bgi);
  2382		cache->space_info = btrfs_find_space_info(info, cache->flags);
  2383	
  2384		set_free_space_tree_thresholds(cache);
  2385	
  2386		if (need_clear) {
  2387			/*
  2388			 * When we mount with old space cache, we need to
  2389			 * set BTRFS_DC_CLEAR and set dirty flag.
  2390			 *
  2391			 * a) Setting 'BTRFS_DC_CLEAR' makes sure that we
  2392			 *    truncate the old free space cache inode and
  2393			 *    setup a new one.
  2394			 * b) Setting 'dirty flag' makes sure that we flush
  2395			 *    the new space cache info onto disk.
  2396			 */
  2397			if (btrfs_test_opt(info, SPACE_CACHE))
  2398				cache->disk_cache_state = BTRFS_DC_CLEAR;
  2399		}
  2400		if (!mixed && ((cache->flags & BTRFS_BLOCK_GROUP_METADATA) &&
  2401		    (cache->flags & BTRFS_BLOCK_GROUP_DATA))) {
  2402				btrfs_err(info,
  2403	"bg %llu is a mixed block group but filesystem hasn't enabled mixed block groups",
  2404					  cache->start);
  2405				ret = -EINVAL;
  2406				goto error;
  2407		}
  2408	
  2409		ret = btrfs_load_block_group_zone_info(cache, false);
  2410		if (ret) {
  2411			btrfs_err(info, "zoned: failed to load zone info of bg %llu",
  2412				  cache->start);
  2413			goto error;
  2414		}
  2415	
  2416		/*
  2417		 * We need to exclude the super stripes now so that the space info has
  2418		 * super bytes accounted for, otherwise we'll think we have more space
  2419		 * than we actually do.
  2420		 */
  2421		ret = exclude_super_stripes(cache);
  2422		if (ret) {
  2423			/* We may have excluded something, so call this just in case. */
  2424			btrfs_free_excluded_extents(cache);
  2425			goto error;
  2426		}
  2427	
  2428		/*
  2429		 * For zoned filesystem, space after the allocation offset is the only
  2430		 * free space for a block group. So, we don't need any caching work.
  2431		 * btrfs_calc_zone_unusable() will set the amount of free space and
  2432		 * zone_unusable space.
  2433		 *
  2434		 * For regular filesystem, check for two cases, either we are full, and
  2435		 * therefore don't need to bother with the caching work since we won't
  2436		 * find any space, or we are empty, and we can just add all the space
  2437		 * in and be done with it.  This saves us _a_lot_ of time, particularly
  2438		 * in the full case.
  2439		 */
  2440		if (btrfs_is_zoned(info)) {
  2441			btrfs_calc_zone_unusable(cache);
  2442			/* Should not have any excluded extents. Just in case, though. */
  2443			btrfs_free_excluded_extents(cache);
  2444		} else if (cache->length == cache->used) {
  2445			cache->cached = BTRFS_CACHE_FINISHED;
  2446			btrfs_free_excluded_extents(cache);
  2447		} else if (cache->used == 0) {
  2448			cache->cached = BTRFS_CACHE_FINISHED;
  2449			ret = btrfs_add_new_free_space(cache, cache->start,
  2450						       cache->start + cache->length, NULL);
  2451			btrfs_free_excluded_extents(cache);
  2452			if (ret)
  2453				goto error;
  2454		}
  2455	
  2456		ret = btrfs_add_block_group_cache(cache);
  2457		if (ret) {
  2458			btrfs_remove_free_space_cache(cache);
  2459			goto error;
  2460		}
  2461	
  2462		trace_btrfs_add_block_group(info, cache, 0);
  2463		btrfs_add_bg_to_space_info(info, cache);
  2464	
  2465		set_avail_alloc_bits(info, cache->flags);
  2466		if (btrfs_chunk_writeable(info, cache->start)) {
  2467			if (cache->used == 0) {
  2468				ASSERT(list_empty(&cache->bg_list));
  2469				if (btrfs_test_opt(info, DISCARD_ASYNC) &&
> 2470				    !(cache->flags && BTRFS_BLOCK_GROUP_REMAPPED)) {
  2471					btrfs_discard_queue_work(&info->discard_ctl, cache);
  2472				} else {
  2473					btrfs_mark_bg_unused(cache);
  2474				}
  2475			}
  2476		} else {
  2477			inc_block_group_ro(cache, 1);
  2478		}
  2479	
  2480		return 0;
  2481	error:
  2482		btrfs_put_block_group(cache);
  2483		return ret;
  2484	}
  2485	

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

  reply	other threads:[~2025-06-06  6:42 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 16:23 [PATCH 00/12] btrfs: remap tree Mark Harmstone
2025-06-05 16:23 ` [PATCH 01/12] btrfs: add definitions and constants for remap-tree Mark Harmstone
2025-06-13 21:02   ` Boris Burkov
2025-06-05 16:23 ` [PATCH 02/12] btrfs: add REMAP chunk type Mark Harmstone
2025-06-13 21:22   ` Boris Burkov
2025-06-05 16:23 ` [PATCH 03/12] btrfs: allow remapped chunks to have zero stripes Mark Harmstone
2025-06-13 21:41   ` Boris Burkov
2025-08-08 14:12     ` Mark Harmstone
2025-06-05 16:23 ` [PATCH 04/12] btrfs: remove remapped block groups from the free-space tree Mark Harmstone
2025-06-06  6:41   ` kernel test robot [this message]
2025-06-13 22:00   ` Boris Burkov
2025-08-12 14:50     ` Mark Harmstone
2025-06-05 16:23 ` [PATCH 05/12] btrfs: don't add metadata items for the remap tree to the extent tree Mark Harmstone
2025-06-13 22:39   ` Boris Burkov
2025-06-05 16:23 ` [PATCH 06/12] btrfs: add extended version of struct block_group_item Mark Harmstone
2025-06-05 16:23 ` [PATCH 07/12] btrfs: allow mounting filesystems with remap-tree incompat flag Mark Harmstone
2025-06-05 16:23 ` [PATCH 08/12] btrfs: redirect I/O for remapped block groups Mark Harmstone
2025-06-05 16:23 ` [PATCH 09/12] btrfs: handle deletions from remapped block group Mark Harmstone
2025-06-13 23:42   ` Boris Burkov
2025-08-11 16:48     ` Mark Harmstone
2025-08-11 16:59     ` Mark Harmstone
2025-06-05 16:23 ` [PATCH 10/12] btrfs: handle setting up relocation of block group with remap-tree Mark Harmstone
2025-06-13 23:25   ` Boris Burkov
2025-08-12 11:20     ` Mark Harmstone
2025-06-05 16:23 ` [PATCH 11/12] btrfs: move existing remaps before relocating block group Mark Harmstone
2025-06-06 11:20   ` kernel test robot
2025-06-05 16:23 ` [PATCH 12/12] btrfs: replace identity maps with actual remaps when doing relocations Mark Harmstone
2025-06-05 16:43 ` [PATCH 00/12] btrfs: remap tree Jonah Sabean
2025-06-06 13:35   ` Mark Harmstone
2025-06-09 16:05     ` Anand Jain
2025-06-09 18:51 ` David Sterba
2025-06-10  9:19   ` Mark Harmstone
2025-06-10 14:31 ` Mark Harmstone
2025-06-10 23:56   ` Qu Wenruo
2025-06-11  8:06     ` Mark Harmstone
2025-06-11 15:28 ` Mark Harmstone
2025-06-14  0:04 ` Boris Burkov
2025-06-26 22:10 ` Mark Harmstone
2025-06-27  5:59   ` Neal Gompa

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=202506061455.6kk5l6Ct-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=maharmstone@fb.com \
    --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