[djwong-xfs:direct-xfile-mapped-buffers 103/333] fs/xfs/xfs_rtalloc.c:1439:17: warning: Value stored to 'off' during its initialization is never read [clang-analyzer-deadcode.DeadStores]

From: kernel test robot
Date: Sat Nov 27 2021 - 08:12:56 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git direct-xfile-mapped-buffers
head: 014cdddffcddd5b13402721de744b9ea76961d74
commit: bd7fa0e8c47bcda25664e1b2572d33a8d61d29c3 [103/333] xfs: make atomic extent swapping support realtime files
config: i386-randconfig-c001-20211031 (https://download.01.org/0day-ci/archive/20211126/202111260911.JKJz6fEX-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d321548c3ce987f4f21350ba1c81fdb5d4354224)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=bd7fa0e8c47bcda25664e1b2572d33a8d61d29c3
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git fetch --no-tags djwong-xfs direct-xfile-mapped-buffers
git checkout bd7fa0e8c47bcda25664e1b2572d33a8d61d29c3
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 clang-analyzer

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


clang-analyzer warnings: (new ones prefixed by >>)

>> fs/xfs/xfs_rtalloc.c:1439:17: warning: Value stored to 'off' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
xfs_fileoff_t off = XFS_B_TO_FSBT(mp, pos);
^~~

vim +/off +1439 fs/xfs/xfs_rtalloc.c

bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1422
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1423 /*
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1424 * For all realtime extents backing the given range of a file, search for
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1425 * unwritten mappings that are do not cover a full rt extent and convert them
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1426 * to zeroed written mappings. The goal is to end up with one mapping per rt
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1427 * extent so that we can perform a remapping operation. Callers must ensure
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1428 * that there are no dirty pages in the given range.
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1429 */
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1430 int
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1431 xfs_rtfile_convert_unwritten(
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1432 struct xfs_inode *ip,
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1433 loff_t pos,
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1434 uint64_t len)
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1435 {
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1436 struct xfs_bmbt_irec irec;
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1437 struct xfs_trans *tp;
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1438 struct xfs_mount *mp = ip->i_mount;
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 @1439 xfs_fileoff_t off = XFS_B_TO_FSBT(mp, pos);
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1440 xfs_fileoff_t endoff;
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1441 unsigned int resblks;
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1442 int ret;
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1443
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1444 if (mp->m_sb.sb_rextsize == 1)
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1445 return 0;
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1446
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 @1447 off = rounddown_64(XFS_B_TO_FSBT(mp, pos), mp->m_sb.sb_rextsize);
bd7fa0e8c47bcda Darrick J. Wong 2021-09-01 1448 endoff = roundup_64(XFS_B_TO_FSB(mp, pos + len), mp->m_sb.sb_rextsize);

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