Linux-XFS Archive on lore.kernel.org
 help / color / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Dave Chinner <david@fromorbit.com>
Cc: kbuild-all@lists.01.org, linux-xfs@vger.kernel.org
Subject: [dgc-xfs:xfs-async-inode-reclaim 2/30] fs/xfs/xfs_trans.c:617:31: warning: comparison of unsigned expression >= 0 is always true
Date: Sat, 23 May 2020 23:12:06 +0800
Message-ID: <202005232305.SwNtJZDm%lkp@intel.com> (raw)


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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git xfs-async-inode-reclaim
head:   a6b06a056446a604d909fd24f24c78f08f5be671
commit: 624f30f880223745ed1ce2de69f15b53e9ac1ea5 [2/30] xfs: gut error handling in xfs_trans_unreserve_and_mod_sb()
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build):
        git checkout 624f30f880223745ed1ce2de69f15b53e9ac1ea5
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>, old ones prefixed by <<):

In file included from include/linux/string.h:6:0,
from include/linux/uuid.h:12,
from fs/xfs/xfs_linux.h:10,
from fs/xfs/xfs.h:22,
from fs/xfs/xfs_trans.c:7:
fs/xfs/xfs_trans.c: In function 'xfs_trans_unreserve_and_mod_sb':
>> fs/xfs/xfs_trans.c:617:31: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
ASSERT(mp->m_sb.sb_frextents >= 0);
^
include/linux/compiler.h:77:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/xfs_trans.c:617:2: note: in expansion of macro 'ASSERT'
ASSERT(mp->m_sb.sb_frextents >= 0);
^~~~~~
fs/xfs/xfs_trans.c:618:29: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
ASSERT(mp->m_sb.sb_dblocks >= 0);
^
include/linux/compiler.h:77:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/xfs_trans.c:618:2: note: in expansion of macro 'ASSERT'
ASSERT(mp->m_sb.sb_dblocks >= 0);
^~~~~~
fs/xfs/xfs_trans.c:619:29: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
ASSERT(mp->m_sb.sb_agcount >= 0);
^
include/linux/compiler.h:77:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/xfs_trans.c:619:2: note: in expansion of macro 'ASSERT'
ASSERT(mp->m_sb.sb_agcount >= 0);
^~~~~~
fs/xfs/xfs_trans.c:621:30: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
ASSERT(mp->m_sb.sb_rextsize >= 0);
^
include/linux/compiler.h:77:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/xfs_trans.c:621:2: note: in expansion of macro 'ASSERT'
ASSERT(mp->m_sb.sb_rextsize >= 0);
^~~~~~
fs/xfs/xfs_trans.c:622:31: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
ASSERT(mp->m_sb.sb_rbmblocks >= 0);
^
include/linux/compiler.h:77:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/xfs_trans.c:622:2: note: in expansion of macro 'ASSERT'
ASSERT(mp->m_sb.sb_rbmblocks >= 0);
^~~~~~
fs/xfs/xfs_trans.c:623:29: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
ASSERT(mp->m_sb.sb_rblocks >= 0);
^
include/linux/compiler.h:77:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/xfs_trans.c:623:2: note: in expansion of macro 'ASSERT'
ASSERT(mp->m_sb.sb_rblocks >= 0);
^~~~~~
fs/xfs/xfs_trans.c:624:30: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
ASSERT(mp->m_sb.sb_rextents >= 0);
^
include/linux/compiler.h:77:40: note: in definition of macro 'likely'
# define likely(x) __builtin_expect(!!(x), 1)
^
fs/xfs/xfs_trans.c:624:2: note: in expansion of macro 'ASSERT'
ASSERT(mp->m_sb.sb_rextents >= 0);
^~~~~~

vim +617 fs/xfs/xfs_trans.c

   536	
   537	/*
   538	 * xfs_trans_unreserve_and_mod_sb() is called to release unused reservations and
   539	 * apply superblock counter changes to the in-core superblock.  The
   540	 * t_res_fdblocks_delta and t_res_frextents_delta fields are explicitly NOT
   541	 * applied to the in-core superblock.  The idea is that that has already been
   542	 * done.
   543	 *
   544	 * If we are not logging superblock counters, then the inode allocated/free and
   545	 * used block counts are not updated in the on disk superblock. In this case,
   546	 * XFS_TRANS_SB_DIRTY will not be set when the transaction is updated but we
   547	 * still need to update the incore superblock with the changes.
   548	 */
   549	void
   550	xfs_trans_unreserve_and_mod_sb(
   551		struct xfs_trans	*tp)
   552	{
   553		struct xfs_mount	*mp = tp->t_mountp;
   554		bool			rsvd = (tp->t_flags & XFS_TRANS_RESERVE) != 0;
   555		int64_t			blkdelta = 0;
   556		int64_t			rtxdelta = 0;
   557		int64_t			idelta = 0;
   558		int64_t			ifreedelta = 0;
   559		int			error;
   560	
   561		/* calculate deltas */
   562		if (tp->t_blk_res > 0)
   563			blkdelta = tp->t_blk_res;
   564		if ((tp->t_fdblocks_delta != 0) &&
   565		    (xfs_sb_version_haslazysbcount(&mp->m_sb) ||
   566		     (tp->t_flags & XFS_TRANS_SB_DIRTY)))
   567		        blkdelta += tp->t_fdblocks_delta;
   568	
   569		if (tp->t_rtx_res > 0)
   570			rtxdelta = tp->t_rtx_res;
   571		if ((tp->t_frextents_delta != 0) &&
   572		    (tp->t_flags & XFS_TRANS_SB_DIRTY))
   573			rtxdelta += tp->t_frextents_delta;
   574	
   575		if (xfs_sb_version_haslazysbcount(&mp->m_sb) ||
   576		     (tp->t_flags & XFS_TRANS_SB_DIRTY)) {
   577			idelta = tp->t_icount_delta;
   578			ifreedelta = tp->t_ifree_delta;
   579		}
   580	
   581		/* apply the per-cpu counters */
   582		if (blkdelta) {
   583			error = xfs_mod_fdblocks(mp, blkdelta, rsvd);
   584			ASSERT(!error);
   585		}
   586	
   587		if (idelta) {
   588			error = xfs_mod_icount(mp, idelta);
   589			ASSERT(!error);
   590		}
   591	
   592		if (ifreedelta) {
   593			error = xfs_mod_ifree(mp, ifreedelta);
   594			ASSERT(!error);
   595		}
   596	
   597		if (rtxdelta == 0 && !(tp->t_flags & XFS_TRANS_SB_DIRTY))
   598			return;
   599	
   600		/* apply remaining deltas */
   601		spin_lock(&mp->m_sb_lock);
   602		mp->m_sb.sb_frextents += rtxdelta;
   603		mp->m_sb.sb_dblocks += tp->t_dblocks_delta;
   604		mp->m_sb.sb_agcount += tp->t_agcount_delta;
   605		mp->m_sb.sb_imax_pct += tp->t_imaxpct_delta;
   606		mp->m_sb.sb_rextsize += tp->t_rextsize_delta;
   607		mp->m_sb.sb_rbmblocks += tp->t_rbmblocks_delta;
   608		mp->m_sb.sb_rblocks += tp->t_rblocks_delta;
   609		mp->m_sb.sb_rextents += tp->t_rextents_delta;
   610		mp->m_sb.sb_rextslog += tp->t_rextslog_delta;
   611		spin_unlock(&mp->m_sb_lock);
   612	
   613		/*
   614		 * Debug checks outside of the spinlock so they don't lock up the
   615		 * machine if they fail.
   616		 */
 > 617		ASSERT(mp->m_sb.sb_frextents >= 0);
   618		ASSERT(mp->m_sb.sb_dblocks >= 0);
   619		ASSERT(mp->m_sb.sb_agcount >= 0);
   620		ASSERT(mp->m_sb.sb_imax_pct >= 0);
   621		ASSERT(mp->m_sb.sb_rextsize >= 0);
   622		ASSERT(mp->m_sb.sb_rbmblocks >= 0);
   623		ASSERT(mp->m_sb.sb_rblocks >= 0);
   624		ASSERT(mp->m_sb.sb_rextents >= 0);
   625		ASSERT(mp->m_sb.sb_rextslog >= 0);
   626		return;
   627	}
   628	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 72514 bytes --]

                 reply index

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=202005232305.SwNtJZDm%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=david@fromorbit.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-xfs@vger.kernel.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

Linux-XFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-xfs/0 linux-xfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-xfs linux-xfs/ https://lore.kernel.org/linux-xfs \
		linux-xfs@vger.kernel.org
	public-inbox-index linux-xfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-xfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git