llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Josef Bacik <josef@toxicpanda.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [btrfs:inode-refcnt 11/13] fs/inode.c:1932:40: warning: use of logical '&&' with constant operand
Date: Thu, 7 Aug 2025 15:37:47 +0800	[thread overview]
Message-ID: <202508071531.Hye67X6N-lkp@intel.com> (raw)

tree:   https://github.com/btrfs/linux.git inode-refcnt
head:   a1d8560a03d8121944d447a9bf373a344d5e83a0
commit: 3f401162cacd05e18ed2b3beae5612a29e1e66e3 [11/13] fs: rework iput logic
config: arm-randconfig-001-20250807 (https://download.01.org/0day-ci/archive/20250807/202508071531.Hye67X6N-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 7b8dea265e72c3037b6b1e54d5ab51b7e14f328b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250807/202508071531.Hye67X6N-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/202508071531.Hye67X6N-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/inode.c:1932:40: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
    1932 |         if (inode->i_nlink && (inode->i_state && I_DIRTY_TIME)) {
         |                                               ^  ~~~~~~~~~~~~
   fs/inode.c:1932:40: note: use '&' for a bitwise operation
    1932 |         if (inode->i_nlink && (inode->i_state && I_DIRTY_TIME)) {
         |                                               ^~
         |                                               &
   fs/inode.c:1932:40: note: remove constant to silence this warning
    1932 |         if (inode->i_nlink && (inode->i_state && I_DIRTY_TIME)) {
         |                                               ^~~~~~~~~~~~~~~
>> fs/inode.c:1932:43: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
    1932 |         if (inode->i_nlink && (inode->i_state && I_DIRTY_TIME)) {
         |                                                  ^
   include/linux/fs.h:2592:26: note: expanded from macro 'I_DIRTY_TIME'
    2592 | #define I_DIRTY_TIME            (1 << 11)
         |                                    ^
   2 warnings generated.


vim +1932 fs/inode.c

  1911	
  1912	/**
  1913	 *	iput	- put an inode
  1914	 *	@inode: inode to put
  1915	 *
  1916	 *	Puts an inode, dropping its usage count. If the inode use count hits
  1917	 *	zero, the inode is then freed and may also be destroyed.
  1918	 *
  1919	 *	Consequently, iput() can sleep.
  1920	 */
  1921	void iput(struct inode *inode)
  1922	{
  1923		if (!inode)
  1924			return;
  1925		BUG_ON(inode->i_state & I_CLEAR);
  1926	
  1927		if (atomic_add_unless(&inode->i_count, -1, 1)) {
  1928			iobj_put(inode);
  1929			return;
  1930		}
  1931	
> 1932		if (inode->i_nlink && (inode->i_state && I_DIRTY_TIME)) {
  1933			trace_writeback_lazytime_iput(inode);
  1934			mark_inode_dirty_sync(inode);
  1935		}
  1936	
  1937		spin_lock(&inode->i_lock);
  1938		if (atomic_dec_and_test(&inode->i_count))
  1939			iput_final(inode);
  1940		else
  1941			spin_unlock(&inode->i_lock);
  1942	
  1943		iobj_put(inode);
  1944	}
  1945	EXPORT_SYMBOL(iput);
  1946	

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

                 reply	other threads:[~2025-08-07  7:40 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=202508071531.Hye67X6N-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=josef@toxicpanda.com \
    --cc=llvm@lists.linux.dev \
    --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;
as well as URLs for NNTP newsgroup(s).