oe-kbuild.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: [hch-xfs:xfs-zoned 44/55] fs/xfs/xfs_zone_gc.c:200:33-34: WARNING opportunity for min()
Date: Tue, 7 May 2024 19:19:22 +0800	[thread overview]
Message-ID: <202405071932.0aH0EnbV-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Christoph Hellwig <hch@lst.de>

tree:   git://git.infradead.org/users/hch/xfs xfs-zoned
head:   2073b21e25895a611d09adb6d56922b1c013e031
commit: f7841e27057069451de4e7758d9703a7293faa60 [44/55] xfs: support zoned RT devices
:::::: branch date: 3 days ago
:::::: commit date: 4 weeks ago
config: i386-randconfig-053-20240507 (https://download.01.org/0day-ci/archive/20240507/202405071932.0aH0EnbV-lkp@intel.com/config)
compiler: clang version 18.1.4 (https://github.com/llvm/llvm-project e6c3289804a67ea0bb6a86fadbe454dd93b8d855)

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>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202405071932.0aH0EnbV-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> fs/xfs/xfs_zone_gc.c:200:33-34: WARNING opportunity for min()

vim +200 fs/xfs/xfs_zone_gc.c

f7841e27057069 Christoph Hellwig 2024-04-10  168  
f7841e27057069 Christoph Hellwig 2024-04-10  169  static int
f7841e27057069 Christoph Hellwig 2024-04-10  170  xfs_zone_gc_query(
f7841e27057069 Christoph Hellwig 2024-04-10  171  	struct xfs_mount	*mp,
f7841e27057069 Christoph Hellwig 2024-04-10  172  	struct xfs_zone_gc_iter	*iter)
f7841e27057069 Christoph Hellwig 2024-04-10  173  {
f7841e27057069 Christoph Hellwig 2024-04-10  174  	struct xfs_rtgroup	*rtg = iter->victim_rtg;
f7841e27057069 Christoph Hellwig 2024-04-10  175  	struct xfs_rmap_irec	ri_low = { };
f7841e27057069 Christoph Hellwig 2024-04-10  176  	struct xfs_rmap_irec	ri_high;
f7841e27057069 Christoph Hellwig 2024-04-10  177  	struct xfs_btree_cur	*cur;
f7841e27057069 Christoph Hellwig 2024-04-10  178  	struct xfs_trans	*tp;
f7841e27057069 Christoph Hellwig 2024-04-10  179  	int			error;
f7841e27057069 Christoph Hellwig 2024-04-10  180  
f7841e27057069 Christoph Hellwig 2024-04-10  181  	ASSERT(iter->next_startblock <= rtg->rtg_blockcount);
f7841e27057069 Christoph Hellwig 2024-04-10  182  	if (iter->next_startblock == rtg->rtg_blockcount)
f7841e27057069 Christoph Hellwig 2024-04-10  183  		goto done;
f7841e27057069 Christoph Hellwig 2024-04-10  184  
f7841e27057069 Christoph Hellwig 2024-04-10  185  	ASSERT(iter->next_startblock < rtg->rtg_blockcount);
f7841e27057069 Christoph Hellwig 2024-04-10  186  	ri_low.rm_startblock = iter->next_startblock;
f7841e27057069 Christoph Hellwig 2024-04-10  187  	memset(&ri_high, 0xFF, sizeof(ri_high));
f7841e27057069 Christoph Hellwig 2024-04-10  188  
f7841e27057069 Christoph Hellwig 2024-04-10  189  	iter->rec_idx = 0;
f7841e27057069 Christoph Hellwig 2024-04-10  190  	iter->rec_count = 0;
f7841e27057069 Christoph Hellwig 2024-04-10  191  
f7841e27057069 Christoph Hellwig 2024-04-10  192  	error = xfs_trans_alloc_empty(mp, &tp);
f7841e27057069 Christoph Hellwig 2024-04-10  193  	if (error)
f7841e27057069 Christoph Hellwig 2024-04-10  194  		return error;
f7841e27057069 Christoph Hellwig 2024-04-10  195  
f7841e27057069 Christoph Hellwig 2024-04-10  196  	xfs_rtgroup_lock(tp, rtg, XFS_RTGLOCK_RMAP);
f7841e27057069 Christoph Hellwig 2024-04-10  197  	cur = xfs_rtrmapbt_init_cursor(mp, tp, rtg, rtg->rtg_rmapip);
f7841e27057069 Christoph Hellwig 2024-04-10  198  	error = xfs_rmap_query_range(cur, &ri_low, &ri_high,
f7841e27057069 Christoph Hellwig 2024-04-10  199  			xfs_zone_gc_query_cb, iter);
f7841e27057069 Christoph Hellwig 2024-04-10 @200  	xfs_btree_del_cursor(cur, error < 0 ? error : 0);
f7841e27057069 Christoph Hellwig 2024-04-10  201  	xfs_trans_cancel(tp);
f7841e27057069 Christoph Hellwig 2024-04-10  202  
f7841e27057069 Christoph Hellwig 2024-04-10  203  	if (error < 0)
f7841e27057069 Christoph Hellwig 2024-04-10  204  		return error;
f7841e27057069 Christoph Hellwig 2024-04-10  205  
f7841e27057069 Christoph Hellwig 2024-04-10  206  	if (error == 0) {
f7841e27057069 Christoph Hellwig 2024-04-10  207  		/*
f7841e27057069 Christoph Hellwig 2024-04-10  208  		 * We finished iterating through the zone.
f7841e27057069 Christoph Hellwig 2024-04-10  209  		 */
f7841e27057069 Christoph Hellwig 2024-04-10  210  		iter->next_startblock = rtg->rtg_blockcount;
f7841e27057069 Christoph Hellwig 2024-04-10  211  		if (iter->rec_count == 0)
f7841e27057069 Christoph Hellwig 2024-04-10  212  			goto done;
f7841e27057069 Christoph Hellwig 2024-04-10  213  	}
f7841e27057069 Christoph Hellwig 2024-04-10  214  
f7841e27057069 Christoph Hellwig 2024-04-10  215  	return 0;
f7841e27057069 Christoph Hellwig 2024-04-10  216  done:
f7841e27057069 Christoph Hellwig 2024-04-10  217  	xfs_rtgroup_rele(iter->victim_rtg);
f7841e27057069 Christoph Hellwig 2024-04-10  218  	iter->victim_rtg = NULL;
f7841e27057069 Christoph Hellwig 2024-04-10  219  	return 0;
f7841e27057069 Christoph Hellwig 2024-04-10  220  }
f7841e27057069 Christoph Hellwig 2024-04-10  221  

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

                 reply	other threads:[~2024-05-07 11:19 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=202405071932.0aH0EnbV-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --cc=oe-kbuild@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).