Hi Nikolay,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on kdave/for-next]
[also build test WARNING on next-20201112]
[cannot apply to btrfs/next v5.10-rc3]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url:
https://github.com/0day-ci/linux/commits/Nikolay-Borisov/btrfs-Simplify-s...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: riscv-randconfig-r014-20201112 (attached as .config)
compiler: clang version 12.0.0 (
https://github.com/llvm/llvm-project
a7b65741441556d295079fc4f2391d99fd1c1111)
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://github.com/0day-ci/linux/commit/aea2237f4b88d91fc8ad6469b205ff6ad...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Nikolay-Borisov/btrfs-Simplify-setup_nodes_for_search/20201112-191847
git checkout aea2237f4b88d91fc8ad6469b205ff6ada2fcf55
# 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(a)intel.com>
All warnings (new ones prefixed by >>):
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:564:9: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inw(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:56:76: note: expanded from macro 'inw'
#define inw(c) ({ u16 __v; __io_pbr(); __v = readw_cpu((void*)(PCI_IOBASE +
(c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:88:76: note: expanded from macro 'readw_cpu'
#define readw_cpu(c) ({ u16 __r = le16_to_cpu((__force
__le16)__raw_readw(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:36:51: note: expanded from macro
'__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from fs/btrfs/ctree.c:10:
In file included from fs/btrfs/ctree.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:572:9: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
return inl(addr);
^~~~~~~~~
arch/riscv/include/asm/io.h:57:76: note: expanded from macro 'inl'
#define inl(c) ({ u32 __v; __io_pbr(); __v = readl_cpu((void*)(PCI_IOBASE +
(c))); __io_par(__v); __v; })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:89:76: note: expanded from macro 'readl_cpu'
#define readl_cpu(c) ({ u32 __r = le32_to_cpu((__force
__le32)__raw_readl(c)); __r; })
^
include/uapi/linux/byteorder/little_endian.h:34:51: note: expanded from macro
'__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from fs/btrfs/ctree.c:10:
In file included from fs/btrfs/ctree.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:580:2: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
outb(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:59:68: note: expanded from macro 'outb'
#define outb(v,c) ({ __io_pbw(); writeb_cpu((v),(void*)(PCI_IOBASE + (c)));
__io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:91:52: note: expanded from macro 'writeb_cpu'
#define writeb_cpu(v, c) ((void)__raw_writeb((v), (c)))
^
In file included from fs/btrfs/ctree.c:10:
In file included from fs/btrfs/ctree.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:588:2: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
outw(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:60:68: note: expanded from macro 'outw'
#define outw(v,c) ({ __io_pbw(); writew_cpu((v),(void*)(PCI_IOBASE + (c)));
__io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:92:76: note: expanded from macro 'writew_cpu'
#define writew_cpu(v, c) ((void)__raw_writew((__force u16)cpu_to_le16(v), (c)))
^
In file included from fs/btrfs/ctree.c:10:
In file included from fs/btrfs/ctree.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:596:2: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
outl(value, addr);
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/io.h:61:68: note: expanded from macro 'outl'
#define outl(v,c) ({ __io_pbw(); writel_cpu((v),(void*)(PCI_IOBASE + (c)));
__io_paw(); })
~~~~~~~~~~ ^
arch/riscv/include/asm/mmio.h:93:76: note: expanded from macro 'writel_cpu'
#define writel_cpu(v, c) ((void)__raw_writel((__force u32)cpu_to_le32(v), (c)))
^
In file included from fs/btrfs/ctree.c:10:
In file included from fs/btrfs/ctree.h:11:
In file included from include/linux/highmem.h:10:
In file included from include/linux/hardirq.h:10:
In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:13:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/riscv/include/asm/io.h:149:
include/asm-generic/io.h:1005:55: warning: performing pointer arithmetic on a null
pointer has undefined behavior [-Wnull-pointer-arithmetic]
return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
~~~~~~~~~~ ^
> fs/btrfs/ctree.c:2408:13: warning: variable 'ret' is used
uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
} else if (ins_len < 0 && btrfs_header_nritems(b) <
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/btrfs/ctree.c:2429:9: note: uninitialized use occurs here
return ret;
^~~
fs/btrfs/ctree.c:2408:9: note: remove the 'if' if its condition is always true
} else if (ins_len < 0 && btrfs_header_nritems(b) <
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> fs/btrfs/ctree.c:2408:13: warning: variable 'ret' is used
uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
} else if (ins_len < 0 && btrfs_header_nritems(b) <
^~~~~~~~~~~
fs/btrfs/ctree.c:2429:9: note: uninitialized use occurs here
return ret;
^~~
fs/btrfs/ctree.c:2408:13: note: remove the '&&' if its condition is
always true
} else if (ins_len < 0 && btrfs_header_nritems(b) <
^~~~~~~~~~~~~~
fs/btrfs/ctree.c:2393:9: note: initialize the variable 'ret' to silence this
warning
int ret;
^
= 0
9 warnings generated.
vim +2408 fs/btrfs/ctree.c
c8c42864f619363 Chris Mason 2009-04-03 2376
c8c42864f619363 Chris Mason 2009-04-03 2377 /*
c8c42864f619363 Chris Mason 2009-04-03 2378 * helper function for
btrfs_search_slot. This does all of the checks
c8c42864f619363 Chris Mason 2009-04-03 2379 * for node-level blocks and does any
balancing required based on
c8c42864f619363 Chris Mason 2009-04-03 2380 * the ins_len.
c8c42864f619363 Chris Mason 2009-04-03 2381 *
c8c42864f619363 Chris Mason 2009-04-03 2382 * If no extra work was required, zero
is returned. If we had to
c8c42864f619363 Chris Mason 2009-04-03 2383 * drop the path, -EAGAIN is returned
and btrfs_search_slot must
c8c42864f619363 Chris Mason 2009-04-03 2384 * start over
c8c42864f619363 Chris Mason 2009-04-03 2385 */
c8c42864f619363 Chris Mason 2009-04-03 2386 static int
c8c42864f619363 Chris Mason 2009-04-03 2387 setup_nodes_for_search(struct
btrfs_trans_handle *trans,
c8c42864f619363 Chris Mason 2009-04-03 2388 struct btrfs_root *root, struct
btrfs_path *p,
bd681513fa6f2ff Chris Mason 2011-07-16 2389 struct extent_buffer *b, int
level, int ins_len,
bd681513fa6f2ff Chris Mason 2011-07-16 2390 int *write_lock_level)
c8c42864f619363 Chris Mason 2009-04-03 2391 {
0b246afa62b0cf5 Jeff Mahoney 2016-06-22 2392 struct btrfs_fs_info *fs_info =
root->fs_info;
c8c42864f619363 Chris Mason 2009-04-03 2393 int ret;
0b246afa62b0cf5 Jeff Mahoney 2016-06-22 2394
c8c42864f619363 Chris Mason 2009-04-03 2395 if ((p->search_for_split || ins_len
> 0) && btrfs_header_nritems(b) >=
0b246afa62b0cf5 Jeff Mahoney 2016-06-22 2396 BTRFS_NODEPTRS_PER_BLOCK(fs_info) -
3) {
c8c42864f619363 Chris Mason 2009-04-03 2397
bd681513fa6f2ff Chris Mason 2011-07-16 2398 if (*write_lock_level < level + 1)
{
bd681513fa6f2ff Chris Mason 2011-07-16 2399 *write_lock_level = level + 1;
bd681513fa6f2ff Chris Mason 2011-07-16 2400 btrfs_release_path(p);
aea2237f4b88d91 Nikolay Borisov 2020-11-12 2401 return -EAGAIN;
bd681513fa6f2ff Chris Mason 2011-07-16 2402 }
bd681513fa6f2ff Chris Mason 2011-07-16 2403
480b65236526f4c Josef Bacik 2020-11-05 2404 reada_for_balance(p, level);
aea2237f4b88d91 Nikolay Borisov 2020-11-12 2405 ret = split_node(trans, root, p,
level);
c8c42864f619363 Chris Mason 2009-04-03 2406
c8c42864f619363 Chris Mason 2009-04-03 2407 b = p->nodes[level];
c8c42864f619363 Chris Mason 2009-04-03 @2408 } else if (ins_len < 0 &&
btrfs_header_nritems(b) <
0b246afa62b0cf5 Jeff Mahoney 2016-06-22 2409 BTRFS_NODEPTRS_PER_BLOCK(fs_info) /
2) {
c8c42864f619363 Chris Mason 2009-04-03 2410
bd681513fa6f2ff Chris Mason 2011-07-16 2411 if (*write_lock_level < level + 1)
{
bd681513fa6f2ff Chris Mason 2011-07-16 2412 *write_lock_level = level + 1;
bd681513fa6f2ff Chris Mason 2011-07-16 2413 btrfs_release_path(p);
aea2237f4b88d91 Nikolay Borisov 2020-11-12 2414 return -EAGAIN;
bd681513fa6f2ff Chris Mason 2011-07-16 2415 }
bd681513fa6f2ff Chris Mason 2011-07-16 2416
480b65236526f4c Josef Bacik 2020-11-05 2417 reada_for_balance(p, level);
aea2237f4b88d91 Nikolay Borisov 2020-11-12 2418 ret = balance_level(trans, root, p,
level);
aea2237f4b88d91 Nikolay Borisov 2020-11-12 2419 if (ret)
aea2237f4b88d91 Nikolay Borisov 2020-11-12 2420 return ret;
c8c42864f619363 Chris Mason 2009-04-03 2421
c8c42864f619363 Chris Mason 2009-04-03 2422 b = p->nodes[level];
c8c42864f619363 Chris Mason 2009-04-03 2423 if (!b) {
b3b4aa74b58bded David Sterba 2011-04-21 2424 btrfs_release_path(p);
aea2237f4b88d91 Nikolay Borisov 2020-11-12 2425 return -EAGAIN;
c8c42864f619363 Chris Mason 2009-04-03 2426 }
c8c42864f619363 Chris Mason 2009-04-03 2427 BUG_ON(btrfs_header_nritems(b) == 1);
c8c42864f619363 Chris Mason 2009-04-03 2428 }
c8c42864f619363 Chris Mason 2009-04-03 2429 return ret;
c8c42864f619363 Chris Mason 2009-04-03 2430 }
c8c42864f619363 Chris Mason 2009-04-03 2431
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org