llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [btrfs:inode-refcnt 11/13] fs/inode.c:1932:40: warning: use of logical '&&' with constant operand
@ 2025-08-07  7:37 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-08-07  7:37 UTC (permalink / raw)
  To: Josef Bacik; +Cc: llvm, oe-kbuild-all

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-07  7:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07  7:37 [btrfs:inode-refcnt 11/13] fs/inode.c:1932:40: warning: use of logical '&&' with constant operand kernel test robot

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).