[xfs-linux:xfs-7.3-merge 37/54] fs/xfs/libxfs/xfs_sb.c:1473:34: warning: variable 'bp' set but not used

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-xfs
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git xfs-7.3-merge
head:   97f34168769238b1fe4412229c99f1a78364f6f9
commit: b9ad0b9891dd0ddbfd8d9bfc7a55b0b70e9871f2 [37/54] xfs: don't hold buffer locks across sync transaction commit in xfs_sync_sb_buf
config: x86_64-rhel-9.4-bpf (https://download.01.org/0day-ci/archive/20260721/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260721/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   In file included from fs/xfs/libxfs/xfs_rtbitmap.h:9,
                    from fs/xfs/libxfs/xfs_sb.c:28:
   fs/xfs/libxfs/xfs_sb.c: In function 'xfs_sync_sb_buf':
>> fs/xfs/libxfs/xfs_rtgroup.h:362:41: warning: statement with no effect [-Wunused-value]
     362 | # define xfs_log_rtsb(tp, sb_bp)        (NULL)
         |                                         ^
   fs/xfs/libxfs/xfs_sb.c:1483:17: note: in expansion of macro 'xfs_log_rtsb'
    1483 |                 xfs_log_rtsb(tp, bp);
         |                 ^~~~~~~~~~~~
>> fs/xfs/libxfs/xfs_sb.c:1473:34: warning: variable 'bp' set but not used [-Wunused-but-set-variable]
    1473 |         struct xfs_buf          *bp;
         |                                  ^~


vim +/bp +1473 fs/xfs/libxfs/xfs_sb.c

b16817b66b6c97 Dave Chinner      2018-05-13  1462  
f7664b31975bd8 Eric Sandeen      2018-05-15  1463  /*
f7664b31975bd8 Eric Sandeen      2018-05-15  1464   * Same behavior as xfs_sync_sb, except that it is always synchronous and it
f7664b31975bd8 Eric Sandeen      2018-05-15  1465   * also writes the superblock buffer to disk sector 0 immediately.
f7664b31975bd8 Eric Sandeen      2018-05-15  1466   */
f7664b31975bd8 Eric Sandeen      2018-05-15  1467  int
f7664b31975bd8 Eric Sandeen      2018-05-15  1468  xfs_sync_sb_buf(
76d3be00df91a5 Darrick J. Wong   2024-11-03  1469  	struct xfs_mount	*mp,
76d3be00df91a5 Darrick J. Wong   2024-11-03  1470  	bool			update_rtsb)
f7664b31975bd8 Eric Sandeen      2018-05-15  1471  {
f7664b31975bd8 Eric Sandeen      2018-05-15  1472  	struct xfs_trans	*tp;
89c2e71123badc Eric Sandeen      2018-06-04 @1473  	struct xfs_buf		*bp;
f7664b31975bd8 Eric Sandeen      2018-05-15  1474  	int			error;
f7664b31975bd8 Eric Sandeen      2018-05-15  1475  
f7664b31975bd8 Eric Sandeen      2018-05-15  1476  	error = xfs_trans_alloc(mp, &M_RES(mp)->tr_sb, 0, 0, 0, &tp);
f7664b31975bd8 Eric Sandeen      2018-05-15  1477  	if (error)
f7664b31975bd8 Eric Sandeen      2018-05-15  1478  		return error;
f7664b31975bd8 Eric Sandeen      2018-05-15  1479  
cead0b10f557a2 Christoph Hellwig 2020-09-01  1480  	bp = xfs_trans_getsb(tp);
f7664b31975bd8 Eric Sandeen      2018-05-15  1481  	xfs_log_sb(tp);
b9ad0b9891dd0d Yun Zhou          2026-07-13  1482  	if (update_rtsb)
b9ad0b9891dd0d Yun Zhou          2026-07-13  1483  		xfs_log_rtsb(tp, bp);
f7664b31975bd8 Eric Sandeen      2018-05-15  1484  	xfs_trans_set_sync(tp);
f7664b31975bd8 Eric Sandeen      2018-05-15  1485  	error = xfs_trans_commit(tp);
f7664b31975bd8 Eric Sandeen      2018-05-15  1486  	if (error)
b9ad0b9891dd0d Yun Zhou          2026-07-13  1487  		return error;
b9ad0b9891dd0d Yun Zhou          2026-07-13  1488  
b9ad0b9891dd0d Yun Zhou          2026-07-13  1489  	/* Re-acquire and write the sb and rtsb to disk. */
b9ad0b9891dd0d Yun Zhou          2026-07-13  1490  	xfs_buf_lock(mp->m_sb_bp);
b9ad0b9891dd0d Yun Zhou          2026-07-13  1491  	xfs_buf_hold(mp->m_sb_bp);
b9ad0b9891dd0d Yun Zhou          2026-07-13  1492  	error = xfs_bwrite(mp->m_sb_bp);
b9ad0b9891dd0d Yun Zhou          2026-07-13  1493  	xfs_buf_relse(mp->m_sb_bp);
b9ad0b9891dd0d Yun Zhou          2026-07-13  1494  	if (error)
b9ad0b9891dd0d Yun Zhou          2026-07-13  1495  		return error;
b9ad0b9891dd0d Yun Zhou          2026-07-13  1496  
b9ad0b9891dd0d Yun Zhou          2026-07-13  1497  	if (update_rtsb && mp->m_rtsb_bp) {
b9ad0b9891dd0d Yun Zhou          2026-07-13  1498  		xfs_buf_lock(mp->m_rtsb_bp);
b9ad0b9891dd0d Yun Zhou          2026-07-13  1499  		xfs_buf_hold(mp->m_rtsb_bp);
b9ad0b9891dd0d Yun Zhou          2026-07-13  1500  		error = xfs_bwrite(mp->m_rtsb_bp);
b9ad0b9891dd0d Yun Zhou          2026-07-13  1501  		xfs_buf_relse(mp->m_rtsb_bp);
b9ad0b9891dd0d Yun Zhou          2026-07-13  1502  	}
b9ad0b9891dd0d Yun Zhou          2026-07-13  1503  
f7664b31975bd8 Eric Sandeen      2018-05-15  1504  	return error;
f7664b31975bd8 Eric Sandeen      2018-05-15  1505  }
f7664b31975bd8 Eric Sandeen      2018-05-15  1506  

:::::: The code at line 1473 was first introduced by commit
:::::: 89c2e71123badc1e75316ccd969ee8a5c6fd921a xfs: use xfs_trans_getsb in xfs_sync_sb_buf

:::::: TO: Eric Sandeen <[email protected]>
:::::: CC: Darrick J. Wong <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.