Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
* [ext4:dev 9/17] fs/ext4/fast_commit.c:1738:5: warning: format specifies type 'int' but the argument has type 'unsigned long'
@ 2021-04-09 18:59 kernel test robot
  2021-04-09 20:44 ` Arnd Bergmann
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-04-09 18:59 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: kbuild-all, clang-built-linux, linux-ext4, Theodore Ts'o, Jan Kara


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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
head:   21175ca434c5d49509b73cf473618b01b0b85437
commit: d556435156b7970b8ce61b355df558a5168927cc [9/17] jbd2: avoid -Wempty-body warnings
config: riscv-randconfig-r005-20210409 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project dd453a1389b6a7e6d9214b449d3c54981b1a89b6)
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
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git/commit/?id=d556435156b7970b8ce61b355df558a5168927cc
        git remote add ext4 https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git
        git fetch --no-tags ext4 dev
        git checkout d556435156b7970b8ce61b355df558a5168927cc
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 

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

All warnings (new ones prefixed by >>):

>> fs/ext4/fast_commit.c:1738:5: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
                                   map.m_flags & EXT4_MAP_UNWRITTEN,
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/jbd2.h:64:51: note: expanded from macro 'jbd_debug'
   #define jbd_debug(n, fmt, a...)  no_printk(fmt, ##a)
                                              ~~~    ^
   include/linux/printk.h:140:17: note: expanded from macro 'no_printk'
                   printk(fmt, ##__VA_ARGS__);             \
                          ~~~    ^~~~~~~~~~~
   1 warning generated.
--
>> fs/jbd2/recovery.c:256:54: warning: more '%' conversions than data arguments [-Wformat-insufficient-args]
                   jbd_debug(3, "Processing fast commit blk with seq %d");
                                                                     ~^
   include/linux/jbd2.h:64:44: note: expanded from macro 'jbd_debug'
   #define jbd_debug(n, fmt, a...)  no_printk(fmt, ##a)
                                              ^~~
   include/linux/printk.h:140:10: note: expanded from macro 'no_printk'
                   printk(fmt, ##__VA_ARGS__);             \
                          ^~~
   1 warning generated.


vim +1738 fs/ext4/fast_commit.c

8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1631  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1632  /* Replay add range tag */
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1633  static int ext4_fc_replay_add_range(struct super_block *sb,
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1634  				struct ext4_fc_tl *tl)
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1635  {
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1636  	struct ext4_fc_add_range *fc_add_ex;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1637  	struct ext4_extent newex, *ex;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1638  	struct inode *inode;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1639  	ext4_lblk_t start, cur;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1640  	int remaining, len;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1641  	ext4_fsblk_t start_pblk;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1642  	struct ext4_map_blocks map;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1643  	struct ext4_ext_path *path = NULL;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1644  	int ret;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1645  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1646  	fc_add_ex = (struct ext4_fc_add_range *)ext4_fc_tag_val(tl);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1647  	ex = (struct ext4_extent *)&fc_add_ex->fc_ex;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1648  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1649  	trace_ext4_fc_replay(sb, EXT4_FC_TAG_ADD_RANGE,
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1650  		le32_to_cpu(fc_add_ex->fc_ino), le32_to_cpu(ex->ee_block),
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1651  		ext4_ext_get_actual_len(ex));
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1652  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1653  	inode = ext4_iget(sb, le32_to_cpu(fc_add_ex->fc_ino),
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1654  				EXT4_IGET_NORMAL);
23dd561ad9eae0 Yi Li              2020-12-30  1655  	if (IS_ERR(inode)) {
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1656  		jbd_debug(1, "Inode not found.");
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1657  		return 0;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1658  	}
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1659  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1660  	ret = ext4_fc_record_modified_inode(sb, inode->i_ino);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1661  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1662  	start = le32_to_cpu(ex->ee_block);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1663  	start_pblk = ext4_ext_pblock(ex);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1664  	len = ext4_ext_get_actual_len(ex);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1665  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1666  	cur = start;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1667  	remaining = len;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1668  	jbd_debug(1, "ADD_RANGE, lblk %d, pblk %lld, len %d, unwritten %d, inode %ld\n",
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1669  		  start, start_pblk, len, ext4_ext_is_unwritten(ex),
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1670  		  inode->i_ino);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1671  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1672  	while (remaining > 0) {
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1673  		map.m_lblk = cur;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1674  		map.m_len = remaining;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1675  		map.m_pblk = 0;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1676  		ret = ext4_map_blocks(NULL, inode, &map, 0);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1677  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1678  		if (ret < 0) {
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1679  			iput(inode);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1680  			return 0;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1681  		}
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1682  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1683  		if (ret == 0) {
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1684  			/* Range is not mapped */
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1685  			path = ext4_find_extent(inode, cur, NULL, 0);
8c9be1e58a8dc0 Harshad Shirwadkar 2020-10-27  1686  			if (IS_ERR(path)) {
8c9be1e58a8dc0 Harshad Shirwadkar 2020-10-27  1687  				iput(inode);
8c9be1e58a8dc0 Harshad Shirwadkar 2020-10-27  1688  				return 0;
8c9be1e58a8dc0 Harshad Shirwadkar 2020-10-27  1689  			}
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1690  			memset(&newex, 0, sizeof(newex));
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1691  			newex.ee_block = cpu_to_le32(cur);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1692  			ext4_ext_store_pblock(
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1693  				&newex, start_pblk + cur - start);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1694  			newex.ee_len = cpu_to_le16(map.m_len);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1695  			if (ext4_ext_is_unwritten(ex))
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1696  				ext4_ext_mark_unwritten(&newex);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1697  			down_write(&EXT4_I(inode)->i_data_sem);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1698  			ret = ext4_ext_insert_extent(
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1699  				NULL, inode, &path, &newex, 0);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1700  			up_write((&EXT4_I(inode)->i_data_sem));
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1701  			ext4_ext_drop_refs(path);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1702  			kfree(path);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1703  			if (ret) {
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1704  				iput(inode);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1705  				return 0;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1706  			}
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1707  			goto next;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1708  		}
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1709  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1710  		if (start_pblk + cur - start != map.m_pblk) {
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1711  			/*
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1712  			 * Logical to physical mapping changed. This can happen
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1713  			 * if this range was removed and then reallocated to
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1714  			 * map to new physical blocks during a fast commit.
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1715  			 */
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1716  			ret = ext4_ext_replay_update_ex(inode, cur, map.m_len,
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1717  					ext4_ext_is_unwritten(ex),
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1718  					start_pblk + cur - start);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1719  			if (ret) {
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1720  				iput(inode);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1721  				return 0;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1722  			}
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1723  			/*
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1724  			 * Mark the old blocks as free since they aren't used
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1725  			 * anymore. We maintain an array of all the modified
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1726  			 * inodes. In case these blocks are still used at either
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1727  			 * a different logical range in the same inode or in
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1728  			 * some different inode, we will mark them as allocated
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1729  			 * at the end of the FC replay using our array of
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1730  			 * modified inodes.
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1731  			 */
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1732  			ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, 0);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1733  			goto next;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1734  		}
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1735  
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1736  		/* Range is mapped and needs a state change */
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1737  		jbd_debug(1, "Converting from %d to %d %lld",
8016e29f4362e2 Harshad Shirwadkar 2020-10-15 @1738  				map.m_flags & EXT4_MAP_UNWRITTEN,
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1739  			ext4_ext_is_unwritten(ex), map.m_pblk);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1740  		ret = ext4_ext_replay_update_ex(inode, cur, map.m_len,
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1741  					ext4_ext_is_unwritten(ex), map.m_pblk);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1742  		if (ret) {
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1743  			iput(inode);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1744  			return 0;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1745  		}
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1746  		/*
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1747  		 * We may have split the extent tree while toggling the state.
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1748  		 * Try to shrink the extent tree now.
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1749  		 */
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1750  		ext4_ext_replay_shrink_inode(inode, start + len);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1751  next:
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1752  		cur += map.m_len;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1753  		remaining -= map.m_len;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1754  	}
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1755  	ext4_ext_replay_shrink_inode(inode, i_size_read(inode) >>
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1756  					sb->s_blocksize_bits);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1757  	iput(inode);
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1758  	return 0;
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1759  }
8016e29f4362e2 Harshad Shirwadkar 2020-10-15  1760  

:::::: The code at line 1738 was first introduced by commit
:::::: 8016e29f4362e285f0f7e38fadc61a5b7bdfdfa2 ext4: fast commit recovery path

:::::: TO: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
:::::: CC: Theodore Ts'o <tytso@mit.edu>

---
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: 40756 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ext4:dev 9/17] fs/ext4/fast_commit.c:1738:5: warning: format specifies type 'int' but the argument has type 'unsigned long'
  2021-04-09 18:59 [ext4:dev 9/17] fs/ext4/fast_commit.c:1738:5: warning: format specifies type 'int' but the argument has type 'unsigned long' kernel test robot
@ 2021-04-09 20:44 ` Arnd Bergmann
  0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2021-04-09 20:44 UTC (permalink / raw)
  To: kernel test robot
  Cc: kbuild-all, clang-built-linux, Ext4 Developers List,
	Theodore Ts'o, Jan Kara

On Fri, Apr 9, 2021 at 8:59 PM kernel test robot <lkp@intel.com> wrote:

>
> All warnings (new ones prefixed by >>):
>
> >> fs/ext4/fast_commit.c:1738:5: warning: format specifies type 'int' but the argument has type 'unsigned long' [-Wformat]
>                                    map.m_flags & EXT4_MAP_UNWRITTEN,
>                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/jbd2.h:64:51: note: expanded from macro 'jbd_debug'
>    #define jbd_debug(n, fmt, a...)  no_printk(fmt, ##a)
>                                               ~~~    ^
>    include/linux/printk.h:140:17: note: expanded from macro 'no_printk'
>                    printk(fmt, ##__VA_ARGS__);             \
>                           ~~~    ^~~~~~~~~~~
>    1 warning generated.
> --
> >> fs/jbd2/recovery.c:256:54: warning: more '%' conversions than data arguments [-Wformat-insufficient-args]
>                    jbd_debug(3, "Processing fast commit blk with seq %d");
>                                                                      ~^
>    include/linux/jbd2.h:64:44: note: expanded from macro 'jbd_debug'
>    #define jbd_debug(n, fmt, a...)  no_printk(fmt, ##a)
>                                               ^~~
>    include/linux/printk.h:140:10: note: expanded from macro 'no_printk'
>                    printk(fmt, ##__VA_ARGS__);             \
>                           ^~~
>    1 warning generated.
>

I sent a patch now. For some reason I ended up testing with -Wempty-body enabled
but all -Wformat warnings disabled when I tested this before sending.

        Arnd

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 18:59 [ext4:dev 9/17] fs/ext4/fast_commit.c:1738:5: warning: format specifies type 'int' but the argument has type 'unsigned long' kernel test robot
2021-04-09 20:44 ` Arnd Bergmann

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/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-ext4 linux-ext4/ https://lore.kernel.org/linux-ext4 \
		linux-ext4@vger.kernel.org
	public-inbox-index linux-ext4

Example config snippet for mirrors

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


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