tree: git://git.infradead.org/users/hch/block.git blkdev.h-includes head: 861642952ebe9d329c3049cf0ab45991c27333e3 commit: 5f9d4a5e4db2d84c769f9406b3a86cdb80b8ab48 [2/17] mm: don't include in config: riscv-buildonly-randconfig-r005-20210906 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 9c476172b93367d2cb88d7d3f4b1b5b456fa6020) 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 git remote add hch-block git://git.infradead.org/users/hch/block.git git fetch --no-tags hch-block blkdev.h-includes git checkout 5f9d4a5e4db2d84c769f9406b3a86cdb80b8ab48 # 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 All errors (new ones prefixed by >>): >> fs/btrfs/compression.c:441:3: error: implicit declaration of function 'kthread_associate_blkcg' [-Werror,-Wimplicit-function-declaration] kthread_associate_blkcg(blkcg_css); ^ fs/btrfs/compression.c:530:3: error: implicit declaration of function 'kthread_associate_blkcg' [-Werror,-Wimplicit-function-declaration] kthread_associate_blkcg(NULL); ^ 2 errors generated. vim +/kthread_associate_blkcg +441 fs/btrfs/compression.c c8b978188c9a0f Chris Mason 2008-10-29 376 c8b978188c9a0f Chris Mason 2008-10-29 377 /* c8b978188c9a0f Chris Mason 2008-10-29 378 * worker function to build and submit bios for previously compressed pages. c8b978188c9a0f Chris Mason 2008-10-29 379 * The corresponding pages in the inode should be marked for writeback c8b978188c9a0f Chris Mason 2008-10-29 380 * and the compressed pages should have a reference on them for dropping c8b978188c9a0f Chris Mason 2008-10-29 381 * when the IO is complete. c8b978188c9a0f Chris Mason 2008-10-29 382 * c8b978188c9a0f Chris Mason 2008-10-29 383 * This also checksums the file bytes and gets things ready for c8b978188c9a0f Chris Mason 2008-10-29 384 * the end io hooks. c8b978188c9a0f Chris Mason 2008-10-29 385 */ c7ee1819dc7169 Nikolay Borisov 2020-06-03 386 blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start, 65b5355f770828 Anand Jain 2021-05-29 387 unsigned int len, u64 disk_start, 65b5355f770828 Anand Jain 2021-05-29 388 unsigned int compressed_len, c8b978188c9a0f Chris Mason 2008-10-29 389 struct page **compressed_pages, 65b5355f770828 Anand Jain 2021-05-29 390 unsigned int nr_pages, ec39f7696ccfac Chris Mason 2019-07-10 391 unsigned int write_flags, ec39f7696ccfac Chris Mason 2019-07-10 392 struct cgroup_subsys_state *blkcg_css) c8b978188c9a0f Chris Mason 2008-10-29 393 { c7ee1819dc7169 Nikolay Borisov 2020-06-03 394 struct btrfs_fs_info *fs_info = inode->root->fs_info; c8b978188c9a0f Chris Mason 2008-10-29 395 struct bio *bio = NULL; c8b978188c9a0f Chris Mason 2008-10-29 396 struct compressed_bio *cb; c8b978188c9a0f Chris Mason 2008-10-29 397 unsigned long bytes_left; 306e16ce13c0f3 David Sterba 2011-04-19 398 int pg_index = 0; c8b978188c9a0f Chris Mason 2008-10-29 399 struct page *page; c8b978188c9a0f Chris Mason 2008-10-29 400 u64 first_byte = disk_start; 4e4cbee93d5613 Christoph Hellwig 2017-06-03 401 blk_status_t ret; c7ee1819dc7169 Nikolay Borisov 2020-06-03 402 int skip_sum = inode->flags & BTRFS_INODE_NODATASUM; 764c7c9a464b68 Johannes Thumshirn 2021-05-19 403 const bool use_append = btrfs_use_zone_append(inode, disk_start); 764c7c9a464b68 Johannes Thumshirn 2021-05-19 404 const unsigned int bio_op = use_append ? REQ_OP_ZONE_APPEND : REQ_OP_WRITE; c8b978188c9a0f Chris Mason 2008-10-29 405 fdb1e121803433 Johannes Thumshirn 2018-12-05 406 WARN_ON(!PAGE_ALIGNED(start)); 2ff7e61e0d30ff Jeff Mahoney 2016-06-22 407 cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS); dac97e516c617f Yoshinori Sano 2011-02-15 408 if (!cb) 4e4cbee93d5613 Christoph Hellwig 2017-06-03 409 return BLK_STS_RESOURCE; a50299ae7cc4ba Elena Reshetova 2017-03-03 410 refcount_set(&cb->pending_bios, 0); c8b978188c9a0f Chris Mason 2008-10-29 411 cb->errors = 0; c7ee1819dc7169 Nikolay Borisov 2020-06-03 412 cb->inode = &inode->vfs_inode; c8b978188c9a0f Chris Mason 2008-10-29 413 cb->start = start; c8b978188c9a0f Chris Mason 2008-10-29 414 cb->len = len; d20f7043fa6565 Chris Mason 2008-12-08 415 cb->mirror_num = 0; c8b978188c9a0f Chris Mason 2008-10-29 416 cb->compressed_pages = compressed_pages; c8b978188c9a0f Chris Mason 2008-10-29 417 cb->compressed_len = compressed_len; c8b978188c9a0f Chris Mason 2008-10-29 418 cb->orig_bio = NULL; c8b978188c9a0f Chris Mason 2008-10-29 419 cb->nr_pages = nr_pages; c8b978188c9a0f Chris Mason 2008-10-29 420 e749af443fa8da David Sterba 2019-06-18 421 bio = btrfs_bio_alloc(first_byte); 764c7c9a464b68 Johannes Thumshirn 2021-05-19 422 bio->bi_opf = bio_op | write_flags; c8b978188c9a0f Chris Mason 2008-10-29 423 bio->bi_private = cb; c8b978188c9a0f Chris Mason 2008-10-29 424 bio->bi_end_io = end_compressed_bio_write; ec39f7696ccfac Chris Mason 2019-07-10 425 764c7c9a464b68 Johannes Thumshirn 2021-05-19 426 if (use_append) { e7ff9e6b8e7d89 Johannes Thumshirn 2021-05-19 427 struct btrfs_device *device; 764c7c9a464b68 Johannes Thumshirn 2021-05-19 428 e7ff9e6b8e7d89 Johannes Thumshirn 2021-05-19 429 device = btrfs_zoned_get_device(fs_info, disk_start, PAGE_SIZE); e7ff9e6b8e7d89 Johannes Thumshirn 2021-05-19 430 if (IS_ERR(device)) { 764c7c9a464b68 Johannes Thumshirn 2021-05-19 431 kfree(cb); 764c7c9a464b68 Johannes Thumshirn 2021-05-19 432 bio_put(bio); 764c7c9a464b68 Johannes Thumshirn 2021-05-19 433 return BLK_STS_NOTSUPP; 764c7c9a464b68 Johannes Thumshirn 2021-05-19 434 } 764c7c9a464b68 Johannes Thumshirn 2021-05-19 435 e7ff9e6b8e7d89 Johannes Thumshirn 2021-05-19 436 bio_set_dev(bio, device->bdev); 764c7c9a464b68 Johannes Thumshirn 2021-05-19 437 } 764c7c9a464b68 Johannes Thumshirn 2021-05-19 438 ec39f7696ccfac Chris Mason 2019-07-10 439 if (blkcg_css) { ec39f7696ccfac Chris Mason 2019-07-10 440 bio->bi_opf |= REQ_CGROUP_PUNT; 46bcff2bfc5e6a Dennis Zhou 2019-12-11 @441 kthread_associate_blkcg(blkcg_css); ec39f7696ccfac Chris Mason 2019-07-10 442 } a50299ae7cc4ba Elena Reshetova 2017-03-03 443 refcount_set(&cb->pending_bios, 1); c8b978188c9a0f Chris Mason 2008-10-29 444 c8b978188c9a0f Chris Mason 2008-10-29 445 /* create and submit bios for the compressed pages */ c8b978188c9a0f Chris Mason 2008-10-29 446 bytes_left = compressed_len; 306e16ce13c0f3 David Sterba 2011-04-19 447 for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) { 4e4cbee93d5613 Christoph Hellwig 2017-06-03 448 int submit = 0; 4c80a97d7b02cf Qu Wenruo 2021-05-25 449 int len = 0; 4e4cbee93d5613 Christoph Hellwig 2017-06-03 450 306e16ce13c0f3 David Sterba 2011-04-19 451 page = compressed_pages[pg_index]; c7ee1819dc7169 Nikolay Borisov 2020-06-03 452 page->mapping = inode->vfs_inode.i_mapping; 4f024f3797c43c Kent Overstreet 2013-10-11 453 if (bio->bi_iter.bi_size) da12fe5414f922 Nikolay Borisov 2018-11-27 454 submit = btrfs_bio_fits_in_stripe(page, PAGE_SIZE, bio, da12fe5414f922 Nikolay Borisov 2018-11-27 455 0); c8b978188c9a0f Chris Mason 2008-10-29 456 4c80a97d7b02cf Qu Wenruo 2021-05-25 457 /* 4c80a97d7b02cf Qu Wenruo 2021-05-25 458 * Page can only be added to bio if the current bio fits in 4c80a97d7b02cf Qu Wenruo 2021-05-25 459 * stripe. 4c80a97d7b02cf Qu Wenruo 2021-05-25 460 */ 4c80a97d7b02cf Qu Wenruo 2021-05-25 461 if (!submit) { 764c7c9a464b68 Johannes Thumshirn 2021-05-19 462 if (pg_index == 0 && use_append) 4c80a97d7b02cf Qu Wenruo 2021-05-25 463 len = bio_add_zone_append_page(bio, page, 4c80a97d7b02cf Qu Wenruo 2021-05-25 464 PAGE_SIZE, 0); 764c7c9a464b68 Johannes Thumshirn 2021-05-19 465 else 764c7c9a464b68 Johannes Thumshirn 2021-05-19 466 len = bio_add_page(bio, page, PAGE_SIZE, 0); 4c80a97d7b02cf Qu Wenruo 2021-05-25 467 } 764c7c9a464b68 Johannes Thumshirn 2021-05-19 468 70b99e6959a4c2 Chris Mason 2008-10-31 469 page->mapping = NULL; 764c7c9a464b68 Johannes Thumshirn 2021-05-19 470 if (submit || len < PAGE_SIZE) { af09abfece59aa Chris Mason 2008-11-07 471 /* af09abfece59aa Chris Mason 2008-11-07 472 * inc the count before we submit the bio so af09abfece59aa Chris Mason 2008-11-07 473 * we know the end IO handler won't happen before af09abfece59aa Chris Mason 2008-11-07 474 * we inc the count. Otherwise, the cb might get af09abfece59aa Chris Mason 2008-11-07 475 * freed before we're done setting it up af09abfece59aa Chris Mason 2008-11-07 476 */ a50299ae7cc4ba Elena Reshetova 2017-03-03 477 refcount_inc(&cb->pending_bios); 0b246afa62b0cf Jeff Mahoney 2016-06-22 478 ret = btrfs_bio_wq_end_io(fs_info, bio, bfebd8b5441755 David Sterba 2014-07-30 479 BTRFS_WQ_ENDIO_DATA); 79787eaab46121 Jeff Mahoney 2012-03-12 480 BUG_ON(ret); /* -ENOMEM */ c8b978188c9a0f Chris Mason 2008-10-29 481 e55179b3d7d41d Li Zefan 2011-07-14 482 if (!skip_sum) { c7ee1819dc7169 Nikolay Borisov 2020-06-03 483 ret = btrfs_csum_one_bio(inode, bio, start, 1); 79787eaab46121 Jeff Mahoney 2012-03-12 484 BUG_ON(ret); /* -ENOMEM */ e55179b3d7d41d Li Zefan 2011-07-14 485 } d20f7043fa6565 Chris Mason 2008-12-08 486 08635bae0b4ceb Chris Mason 2019-07-10 487 ret = btrfs_map_bio(fs_info, bio, 0); f5daf2c780f2dd Liu Bo 2016-06-22 488 if (ret) { 4e4cbee93d5613 Christoph Hellwig 2017-06-03 489 bio->bi_status = ret; f5daf2c780f2dd Liu Bo 2016-06-22 490 bio_endio(bio); f5daf2c780f2dd Liu Bo 2016-06-22 491 } c8b978188c9a0f Chris Mason 2008-10-29 492 e749af443fa8da David Sterba 2019-06-18 493 bio = btrfs_bio_alloc(first_byte); 764c7c9a464b68 Johannes Thumshirn 2021-05-19 494 bio->bi_opf = bio_op | write_flags; c8b978188c9a0f Chris Mason 2008-10-29 495 bio->bi_private = cb; c8b978188c9a0f Chris Mason 2008-10-29 496 bio->bi_end_io = end_compressed_bio_write; 46bcff2bfc5e6a Dennis Zhou 2019-12-11 497 if (blkcg_css) 7b62e66cbbfb46 Dennis Zhou 2019-12-11 498 bio->bi_opf |= REQ_CGROUP_PUNT; 764c7c9a464b68 Johannes Thumshirn 2021-05-19 499 /* 764c7c9a464b68 Johannes Thumshirn 2021-05-19 500 * Use bio_add_page() to ensure the bio has at least one 764c7c9a464b68 Johannes Thumshirn 2021-05-19 501 * page. 764c7c9a464b68 Johannes Thumshirn 2021-05-19 502 */ 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 503 bio_add_page(bio, page, PAGE_SIZE, 0); c8b978188c9a0f Chris Mason 2008-10-29 504 } 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 505 if (bytes_left < PAGE_SIZE) { 0b246afa62b0cf Jeff Mahoney 2016-06-22 506 btrfs_info(fs_info, 282ab3ff16120e David Sterba 2019-10-14 507 "bytes left %lu compress len %u nr %u", cfbc246eaae2a1 Chris Mason 2008-10-30 508 bytes_left, cb->compressed_len, cb->nr_pages); cfbc246eaae2a1 Chris Mason 2008-10-30 509 } 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 510 bytes_left -= PAGE_SIZE; 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 511 first_byte += PAGE_SIZE; 771ed689d2cd53 Chris Mason 2008-11-06 512 cond_resched(); c8b978188c9a0f Chris Mason 2008-10-29 513 } c8b978188c9a0f Chris Mason 2008-10-29 514 0b246afa62b0cf Jeff Mahoney 2016-06-22 515 ret = btrfs_bio_wq_end_io(fs_info, bio, BTRFS_WQ_ENDIO_DATA); 79787eaab46121 Jeff Mahoney 2012-03-12 516 BUG_ON(ret); /* -ENOMEM */ c8b978188c9a0f Chris Mason 2008-10-29 517 e55179b3d7d41d Li Zefan 2011-07-14 518 if (!skip_sum) { c7ee1819dc7169 Nikolay Borisov 2020-06-03 519 ret = btrfs_csum_one_bio(inode, bio, start, 1); 79787eaab46121 Jeff Mahoney 2012-03-12 520 BUG_ON(ret); /* -ENOMEM */ e55179b3d7d41d Li Zefan 2011-07-14 521 } d20f7043fa6565 Chris Mason 2008-12-08 522 08635bae0b4ceb Chris Mason 2019-07-10 523 ret = btrfs_map_bio(fs_info, bio, 0); f5daf2c780f2dd Liu Bo 2016-06-22 524 if (ret) { 4e4cbee93d5613 Christoph Hellwig 2017-06-03 525 bio->bi_status = ret; f5daf2c780f2dd Liu Bo 2016-06-22 526 bio_endio(bio); f5daf2c780f2dd Liu Bo 2016-06-22 527 } c8b978188c9a0f Chris Mason 2008-10-29 528 46bcff2bfc5e6a Dennis Zhou 2019-12-11 529 if (blkcg_css) 46bcff2bfc5e6a Dennis Zhou 2019-12-11 530 kthread_associate_blkcg(NULL); 46bcff2bfc5e6a Dennis Zhou 2019-12-11 531 c8b978188c9a0f Chris Mason 2008-10-29 532 return 0; c8b978188c9a0f Chris Mason 2008-10-29 533 } c8b978188c9a0f Chris Mason 2008-10-29 534 :::::: The code at line 441 was first introduced by commit :::::: 46bcff2bfc5e6a8c638d3a32e4f6f6fa4bd01461 btrfs: fix compressed write bio blkcg attribution :::::: TO: Dennis Zhou :::::: CC: David Sterba --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org