tree: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev head: a492dedb708d287aac857c6799f6f364f3d914b3 commit: 84ed553af7e5c8f3f3de0160ba7eaabcab8b9f7b [40/42] ext4: add discard/zeroout flags to journal flush config: arm-randconfig-m031-20210604 (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> smatch warnings: fs/jbd2/journal.c:1718 __jbd2_journal_erase() warn: maybe use && instead of & vim +1718 fs/jbd2/journal.c 84ed553af7e5c8 Leah Rumancik 2021-05-18 1701 static int __jbd2_journal_erase(journal_t *journal, unsigned int flags) 84ed553af7e5c8 Leah Rumancik 2021-05-18 1702 { 84ed553af7e5c8 Leah Rumancik 2021-05-18 1703 int err = 0; 84ed553af7e5c8 Leah Rumancik 2021-05-18 1704 unsigned long block, log_offset; /* logical */ 84ed553af7e5c8 Leah Rumancik 2021-05-18 1705 unsigned long long phys_block, block_start, block_stop; /* physical */ 84ed553af7e5c8 Leah Rumancik 2021-05-18 1706 loff_t byte_start, byte_stop, byte_count; 84ed553af7e5c8 Leah Rumancik 2021-05-18 1707 struct request_queue *q = bdev_get_queue(journal->j_dev); 84ed553af7e5c8 Leah Rumancik 2021-05-18 1708 84ed553af7e5c8 Leah Rumancik 2021-05-18 1709 /* flags must be set to either discard or zeroout */ 84ed553af7e5c8 Leah Rumancik 2021-05-18 1710 if ((flags & ~JBD2_JOURNAL_FLUSH_VALID) || !flags || 84ed553af7e5c8 Leah Rumancik 2021-05-18 1711 ((flags & JBD2_JOURNAL_FLUSH_DISCARD) && 84ed553af7e5c8 Leah Rumancik 2021-05-18 1712 (flags & JBD2_JOURNAL_FLUSH_ZEROOUT))) 84ed553af7e5c8 Leah Rumancik 2021-05-18 1713 return -EINVAL; 84ed553af7e5c8 Leah Rumancik 2021-05-18 1714 84ed553af7e5c8 Leah Rumancik 2021-05-18 1715 if (!q) 84ed553af7e5c8 Leah Rumancik 2021-05-18 1716 return -ENXIO; 84ed553af7e5c8 Leah Rumancik 2021-05-18 1717 84ed553af7e5c8 Leah Rumancik 2021-05-18 @1718 if (JBD2_JOURNAL_FLUSH_DISCARD & !blk_queue_discard(q)) JBD2_JOURNAL_FLUSH_DISCARD is 1 so this works, but probably && was intended. Using && should be a little bit faster. blk_queue_discard() is just a wrapper around test_bit() so it doesn't have side effects. 84ed553af7e5c8 Leah Rumancik 2021-05-18 1719 return -EOPNOTSUPP; 84ed553af7e5c8 Leah Rumancik 2021-05-18 1720 84ed553af7e5c8 Leah Rumancik 2021-05-18 1721 /* 84ed553af7e5c8 Leah Rumancik 2021-05-18 1722 * lookup block mapping and issue discard/zeroout for each 84ed553af7e5c8 Leah Rumancik 2021-05-18 1723 * contiguous region 84ed553af7e5c8 Leah Rumancik 2021-05-18 1724 */ 84ed553af7e5c8 Leah Rumancik 2021-05-18 1725 log_offset = be32_to_cpu(journal->j_superblock->s_first); 84ed553af7e5c8 Leah Rumancik 2021-05-18 1726 block_start = ~0ULL; 84ed553af7e5c8 Leah Rumancik 2021-05-18 1727 for (block = log_offset; block < journal->j_total_len; block++) { 84ed553af7e5c8 Leah Rumancik 2021-05-18 1728 err = jbd2_journal_bmap(journal, block, &phys_block); 84ed553af7e5c8 Leah Rumancik 2021-05-18 1729 if (err) { 84ed553af7e5c8 Leah Rumancik 2021-05-18 1730 pr_err("JBD2: bad block at offset %lu", block); --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx