[axboe-block:for-5.16/block 189/189] block/fops.c:530:23: error: implicit declaration of function 'bdev_nr_bytes'

From: kernel test robot
Date: Fri Nov 05 2021 - 10:01:56 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-5.16/block
head: d4e76b1ad0065477119b544fd93c2f03550ef548
commit: d4e76b1ad0065477119b544fd93c2f03550ef548 [189/189] block: use new bdev_nr_bytes() helper for blkdev_{read,write}_iter()
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.0
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/axboe/linux-block.git/commit/?id=d4e76b1ad0065477119b544fd93c2f03550ef548
git remote add axboe-block https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
git fetch --no-tags axboe-block for-5.16/block
git checkout d4e76b1ad0065477119b544fd93c2f03550ef548
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64

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

All errors (new ones prefixed by >>):

block/fops.c: In function 'blkdev_write_iter':
>> block/fops.c:530:23: error: implicit declaration of function 'bdev_nr_bytes' [-Werror=implicit-function-declaration]
530 | loff_t size = bdev_nr_bytes(bdev);
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors


vim +/bdev_nr_bytes +530 block/fops.c

518
519 /*
520 * Write data to the block device. Only intended for the block device itself
521 * and the raw driver which basically is a fake block device.
522 *
523 * Does not take i_mutex for the write and thus is not for general purpose
524 * use.
525 */
526 static ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
527 {
528 struct block_device *bdev = iocb->ki_filp->private_data;
529 struct inode *bd_inode = bdev->bd_inode;
> 530 loff_t size = bdev_nr_bytes(bdev);
531 struct blk_plug plug;
532 size_t shorted = 0;
533 ssize_t ret;
534
535 if (bdev_read_only(bdev))
536 return -EPERM;
537
538 if (IS_SWAPFILE(bd_inode) && !is_hibernate_resume_dev(bd_inode->i_rdev))
539 return -ETXTBSY;
540
541 if (!iov_iter_count(from))
542 return 0;
543
544 if (iocb->ki_pos >= size)
545 return -ENOSPC;
546
547 if ((iocb->ki_flags & (IOCB_NOWAIT | IOCB_DIRECT)) == IOCB_NOWAIT)
548 return -EOPNOTSUPP;
549
550 size -= iocb->ki_pos;
551 if (iov_iter_count(from) > size) {
552 shorted = iov_iter_count(from) - size;
553 iov_iter_truncate(from, size);
554 }
555
556 blk_start_plug(&plug);
557 ret = __generic_file_write_iter(iocb, from);
558 if (ret > 0)
559 ret = generic_write_sync(iocb, ret);
560 iov_iter_reexpand(from, iov_iter_count(from) + shorted);
561 blk_finish_plug(&plug);
562 return ret;
563 }
564

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

Attachment: .config.gz
Description: application/gzip