All of lore.kernel.org
 help / color / mirror / Atom feed
* [hch-block:blkdev.h-includes 8/8] drivers/target/target_core_iblock.c:662:11: warning: declaration of 'struct sg_mapping_iter' will not be visible outside of this function
@ 2021-09-04 16:41 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-09-04 16:41 UTC (permalink / raw)
  To: kbuild-all

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

tree:   git://git.infradead.org/users/hch/block.git blkdev.h-includes
head:   c404937ee66601b9936ecbe31d7f24a396ead2c2
commit: c404937ee66601b9936ecbe31d7f24a396ead2c2 [8/8] block: move struct request to blk-mq.h
config: riscv-randconfig-r013-20210904 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6fe2beba7d2a41964af658c8c59dd172683ef739)
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 c404937ee66601b9936ecbe31d7f24a396ead2c2
        # 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 >>):

                        ^
   drivers/target/target_core_iblock.c:150:26: error: incomplete definition of type 'struct blk_integrity_profile'
                   if (!strcmp(bi->profile->name, "T10-DIF-TYPE3-CRC")) {
                               ~~~~~~~~~~~^
   include/linux/genhd.h:120:15: note: forward declaration of 'struct blk_integrity_profile'
           const struct blk_integrity_profile      *profile;
                        ^
   drivers/target/target_core_iblock.c:152:33: error: incomplete definition of type 'struct blk_integrity_profile'
                   } else if (!strcmp(bi->profile->name, "T10-DIF-TYPE1-CRC")) {
                                      ~~~~~~~~~~~^
   include/linux/genhd.h:120:15: note: forward declaration of 'struct blk_integrity_profile'
           const struct blk_integrity_profile      *profile;
                        ^
   drivers/target/target_core_iblock.c:452:42: error: subscript of pointer to incomplete type 'struct scatterlist'
           struct scatterlist *sg = &cmd->t_data_sg[0];
                                     ~~~~~~~~~~~~~~^
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
   drivers/target/target_core_iblock.c:456:13: error: implicit declaration of function 'sg_page' [-Werror,-Wimplicit-function-declaration]
           buf = kmap(sg_page(sg)) + sg->offset;
                      ^
   drivers/target/target_core_iblock.c:456:13: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct page *' [-Wint-conversion]
           buf = kmap(sg_page(sg)) + sg->offset;
                      ^~~~~~~~~~~
   include/linux/highmem.h:37:39: note: passing argument to parameter 'page' here
   static inline void *kmap(struct page *page);
                                         ^
   drivers/target/target_core_iblock.c:456:30: error: incomplete definition of type 'struct scatterlist'
           buf = kmap(sg_page(sg)) + sg->offset;
                                     ~~^
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
   drivers/target/target_core_iblock.c:464:9: warning: incompatible integer to pointer conversion passing 'int' to parameter of type 'struct page *' [-Wint-conversion]
           kunmap(sg_page(sg));
                  ^~~~~~~~~~~
   include/linux/highmem.h:46:40: note: passing argument to parameter 'page' here
   static inline void kunmap(struct page *page);
                                          ^
   drivers/target/target_core_iblock.c:499:22: error: subscript of pointer to incomplete type 'struct scatterlist'
           sg = &cmd->t_data_sg[0];
                 ~~~~~~~~~~~~~~^
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
   drivers/target/target_core_iblock.c:502:8: error: incomplete definition of type 'struct scatterlist'
               sg->length != cmd->se_dev->dev_attrib.block_size) {
               ~~^
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
   drivers/target/target_core_iblock.c:504:46: error: incomplete definition of type 'struct scatterlist'
                           " block_size: %u\n", cmd->t_data_nents, sg->length,
                                                                   ~~^
   include/linux/printk.h:489:33: note: expanded from macro 'pr_err'
           printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
                                          ^~~~~~~~~~~
   include/linux/printk.h:446:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                              ^~~~~~~~~~~
   include/linux/printk.h:418:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                                   ^~~~~~~~~~~
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
   drivers/target/target_core_iblock.c:529:28: error: implicit declaration of function 'sg_page' [-Werror,-Wimplicit-function-declaration]
                   while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
                                            ^
   drivers/target/target_core_iblock.c:529:43: error: incomplete definition of type 'struct scatterlist'
                   while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
                                                         ~~^
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
   drivers/target/target_core_iblock.c:529:55: error: incomplete definition of type 'struct scatterlist'
                   while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
                                                                     ~~^
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
   drivers/target/target_core_iblock.c:530:10: error: incomplete definition of type 'struct scatterlist'
                                   != sg->length) {
                                      ~~^
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
   drivers/target/target_core_iblock.c:541:18: error: incomplete definition of type 'struct scatterlist'
                   block_lba += sg->length >> SECTOR_SHIFT;
                                ~~^
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
   drivers/target/target_core_iblock.c:542:16: error: incomplete definition of type 'struct scatterlist'
                   sectors -= sg->length >> SECTOR_SHIFT;
                              ~~^
   include/target/target_core_base.h:522:9: note: forward declaration of 'struct scatterlist'
           struct scatterlist      *t_data_sg;
                  ^
>> drivers/target/target_core_iblock.c:662:11: warning: declaration of 'struct sg_mapping_iter' will not be visible outside of this function [-Wvisibility]
                    struct sg_mapping_iter *miter)
                           ^
   drivers/target/target_core_iblock.c:671:7: error: implicit declaration of function 'bdev_get_integrity' [-Werror,-Wimplicit-function-declaration]
           bi = bdev_get_integrity(ib_dev->ibd_bd);
                ^
   drivers/target/target_core_iblock.c:671:5: warning: incompatible integer to pointer conversion assigning to 'struct blk_integrity *' from 'int' [-Wint-conversion]
           bi = bdev_get_integrity(ib_dev->ibd_bd);
              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   5 warnings and 20 errors generated.


vim +662 drivers/target/target_core_iblock.c

07b6319687026b Mike Christie             2016-02-24  480  
f6970ad31d42fc Nicholas Bellinger        2012-11-07  481  static sense_reason_t
f6970ad31d42fc Nicholas Bellinger        2012-11-07  482  iblock_execute_write_same(struct se_cmd *cmd)
f6970ad31d42fc Nicholas Bellinger        2012-11-07  483  {
07b6319687026b Mike Christie             2016-02-24  484  	struct block_device *bdev = IBLOCK_DEV(cmd->se_dev)->ibd_bd;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  485  	struct iblock_req *ibr;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  486  	struct scatterlist *sg;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  487  	struct bio *bio;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  488  	struct bio_list list;
8a9ebe717a133b Mike Christie             2016-01-18  489  	struct se_device *dev = cmd->se_dev;
8a9ebe717a133b Mike Christie             2016-01-18  490  	sector_t block_lba = target_to_linux_sector(dev, cmd->t_task_lba);
8a9ebe717a133b Mike Christie             2016-01-18  491  	sector_t sectors = target_to_linux_sector(dev,
8a9ebe717a133b Mike Christie             2016-01-18  492  					sbc_get_write_same_sectors(cmd));
f6970ad31d42fc Nicholas Bellinger        2012-11-07  493  
afd73f1b60fc58 Nicholas Bellinger        2015-02-14  494  	if (cmd->prot_op) {
afd73f1b60fc58 Nicholas Bellinger        2015-02-14  495  		pr_err("WRITE_SAME: Protection information with IBLOCK"
afd73f1b60fc58 Nicholas Bellinger        2015-02-14  496  		       " backends not supported\n");
afd73f1b60fc58 Nicholas Bellinger        2015-02-14  497  		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
afd73f1b60fc58 Nicholas Bellinger        2015-02-14  498  	}
f6970ad31d42fc Nicholas Bellinger        2012-11-07  499  	sg = &cmd->t_data_sg[0];
f6970ad31d42fc Nicholas Bellinger        2012-11-07  500  
f6970ad31d42fc Nicholas Bellinger        2012-11-07  501  	if (cmd->t_data_nents > 1 ||
f6970ad31d42fc Nicholas Bellinger        2012-11-07  502  	    sg->length != cmd->se_dev->dev_attrib.block_size) {
f6970ad31d42fc Nicholas Bellinger        2012-11-07  503  		pr_err("WRITE_SAME: Illegal SGL t_data_nents: %u length: %u"
f6970ad31d42fc Nicholas Bellinger        2012-11-07  504  			" block_size: %u\n", cmd->t_data_nents, sg->length,
f6970ad31d42fc Nicholas Bellinger        2012-11-07  505  			cmd->se_dev->dev_attrib.block_size);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  506  		return TCM_INVALID_CDB_FIELD;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  507  	}
f6970ad31d42fc Nicholas Bellinger        2012-11-07  508  
2237498f0b5c74 Nicholas Bellinger        2017-04-11  509  	if (bdev_write_zeroes_sectors(bdev)) {
2237498f0b5c74 Nicholas Bellinger        2017-04-11  510  		if (!iblock_execute_zero_out(bdev, cmd))
2237498f0b5c74 Nicholas Bellinger        2017-04-11  511  			return 0;
2237498f0b5c74 Nicholas Bellinger        2017-04-11  512  	}
07b6319687026b Mike Christie             2016-02-24  513  
f6970ad31d42fc Nicholas Bellinger        2012-11-07  514  	ibr = kzalloc(sizeof(struct iblock_req), GFP_KERNEL);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  515  	if (!ibr)
f6970ad31d42fc Nicholas Bellinger        2012-11-07  516  		goto fail;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  517  	cmd->priv = ibr;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  518  
bc9e0e366fceda Chaitanya Kulkarni        2021-02-27  519  	bio = iblock_get_bio(cmd, block_lba, 1, REQ_OP_WRITE);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  520  	if (!bio)
f6970ad31d42fc Nicholas Bellinger        2012-11-07  521  		goto fail_free_ibr;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  522  
f6970ad31d42fc Nicholas Bellinger        2012-11-07  523  	bio_list_init(&list);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  524  	bio_list_add(&list, bio);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  525  
5981c245a890db Elena Reshetova           2017-03-06  526  	refcount_set(&ibr->pending, 1);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  527  
f6970ad31d42fc Nicholas Bellinger        2012-11-07  528  	while (sectors) {
f6970ad31d42fc Nicholas Bellinger        2012-11-07  529  		while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
f6970ad31d42fc Nicholas Bellinger        2012-11-07  530  				!= sg->length) {
f6970ad31d42fc Nicholas Bellinger        2012-11-07  531  
bc9e0e366fceda Chaitanya Kulkarni        2021-02-27  532  			bio = iblock_get_bio(cmd, block_lba, 1, REQ_OP_WRITE);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  533  			if (!bio)
f6970ad31d42fc Nicholas Bellinger        2012-11-07  534  				goto fail_put_bios;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  535  
5981c245a890db Elena Reshetova           2017-03-06  536  			refcount_inc(&ibr->pending);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  537  			bio_list_add(&list, bio);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  538  		}
f6970ad31d42fc Nicholas Bellinger        2012-11-07  539  
f6970ad31d42fc Nicholas Bellinger        2012-11-07  540  		/* Always in 512 byte units for Linux/Block */
80b045b385cfef Bart Van Assche           2018-10-15  541  		block_lba += sg->length >> SECTOR_SHIFT;
5676234f20fef0 Roman Bolshakov           2019-07-02 @542  		sectors -= sg->length >> SECTOR_SHIFT;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  543  	}
f6970ad31d42fc Nicholas Bellinger        2012-11-07  544  
4e49ea4a3d2763 Mike Christie             2016-06-05  545  	iblock_submit_bios(&list);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  546  	return 0;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  547  
f6970ad31d42fc Nicholas Bellinger        2012-11-07  548  fail_put_bios:
f6970ad31d42fc Nicholas Bellinger        2012-11-07  549  	while ((bio = bio_list_pop(&list)))
f6970ad31d42fc Nicholas Bellinger        2012-11-07  550  		bio_put(bio);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  551  fail_free_ibr:
f6970ad31d42fc Nicholas Bellinger        2012-11-07  552  	kfree(ibr);
f6970ad31d42fc Nicholas Bellinger        2012-11-07  553  fail:
f6970ad31d42fc Nicholas Bellinger        2012-11-07  554  	return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
f6970ad31d42fc Nicholas Bellinger        2012-11-07  555  }
f6970ad31d42fc Nicholas Bellinger        2012-11-07  556  
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  557  enum {
44bfd0185043c9 Andy Grover               2012-06-07  558  	Opt_udev_path, Opt_readonly, Opt_force, Opt_err
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  559  };
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  560  
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  561  static match_table_t tokens = {
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  562  	{Opt_udev_path, "udev_path=%s"},
44bfd0185043c9 Andy Grover               2012-06-07  563  	{Opt_readonly, "readonly=%d"},
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  564  	{Opt_force, "force=%d"},
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  565  	{Opt_err, NULL}
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  566  };
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  567  
0fd97ccf45be26 Christoph Hellwig         2012-10-08  568  static ssize_t iblock_set_configfs_dev_params(struct se_device *dev,
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  569  		const char *page, ssize_t count)
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  570  {
0fd97ccf45be26 Christoph Hellwig         2012-10-08  571  	struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
6d1802539d218e Jesper Juhl               2011-03-14  572  	char *orig, *ptr, *arg_p, *opts;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  573  	substring_t args[MAX_OPT_ARGS];
21bca31c9678ed Roland Dreier             2011-07-05  574  	int ret = 0, token;
44bfd0185043c9 Andy Grover               2012-06-07  575  	unsigned long tmp_readonly;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  576  
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  577  	opts = kstrdup(page, GFP_KERNEL);
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  578  	if (!opts)
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  579  		return -ENOMEM;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  580  
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  581  	orig = opts;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  582  
90c161b643d953 Sebastian Andrzej Siewior 2011-11-23  583  	while ((ptr = strsep(&opts, ",\n")) != NULL) {
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  584  		if (!*ptr)
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  585  			continue;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  586  
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  587  		token = match_token(ptr, tokens, args);
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  588  		switch (token) {
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  589  		case Opt_udev_path:
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  590  			if (ib_dev->ibd_bd) {
6708bb27bb2703 Andy Grover               2011-06-08  591  				pr_err("Unable to set udev_path= while"
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  592  					" ib_dev->ibd_bd exists\n");
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  593  				ret = -EEXIST;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  594  				goto out;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  595  			}
852b6ed1109908 Nicholas Bellinger        2012-08-22  596  			if (match_strlcpy(ib_dev->ibd_udev_path, &args[0],
852b6ed1109908 Nicholas Bellinger        2012-08-22  597  				SE_UDEV_PATH_LEN) == 0) {
852b6ed1109908 Nicholas Bellinger        2012-08-22  598  				ret = -EINVAL;
6d1802539d218e Jesper Juhl               2011-03-14  599  				break;
6d1802539d218e Jesper Juhl               2011-03-14  600  			}
6708bb27bb2703 Andy Grover               2011-06-08  601  			pr_debug("IBLOCK: Referencing UDEV path: %s\n",
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  602  					ib_dev->ibd_udev_path);
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  603  			ib_dev->ibd_flags |= IBDF_HAS_UDEV_PATH;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  604  			break;
44bfd0185043c9 Andy Grover               2012-06-07  605  		case Opt_readonly:
44bfd0185043c9 Andy Grover               2012-06-07  606  			arg_p = match_strdup(&args[0]);
44bfd0185043c9 Andy Grover               2012-06-07  607  			if (!arg_p) {
44bfd0185043c9 Andy Grover               2012-06-07  608  				ret = -ENOMEM;
44bfd0185043c9 Andy Grover               2012-06-07  609  				break;
44bfd0185043c9 Andy Grover               2012-06-07  610  			}
57103d7fe18338 Jingoo Han                2013-07-19  611  			ret = kstrtoul(arg_p, 0, &tmp_readonly);
44bfd0185043c9 Andy Grover               2012-06-07  612  			kfree(arg_p);
44bfd0185043c9 Andy Grover               2012-06-07  613  			if (ret < 0) {
57103d7fe18338 Jingoo Han                2013-07-19  614  				pr_err("kstrtoul() failed for"
44bfd0185043c9 Andy Grover               2012-06-07  615  						" readonly=\n");
44bfd0185043c9 Andy Grover               2012-06-07  616  				goto out;
44bfd0185043c9 Andy Grover               2012-06-07  617  			}
44bfd0185043c9 Andy Grover               2012-06-07  618  			ib_dev->ibd_readonly = tmp_readonly;
44bfd0185043c9 Andy Grover               2012-06-07  619  			pr_debug("IBLOCK: readonly: %d\n", ib_dev->ibd_readonly);
44bfd0185043c9 Andy Grover               2012-06-07  620  			break;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  621  		case Opt_force:
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  622  			break;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  623  		default:
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  624  			break;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  625  		}
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  626  	}
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  627  
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  628  out:
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  629  	kfree(orig);
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  630  	return (!ret) ? count : ret;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  631  }
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  632  
0fd97ccf45be26 Christoph Hellwig         2012-10-08  633  static ssize_t iblock_show_configfs_dev_params(struct se_device *dev, char *b)
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  634  {
0fd97ccf45be26 Christoph Hellwig         2012-10-08  635  	struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
0fd97ccf45be26 Christoph Hellwig         2012-10-08  636  	struct block_device *bd = ib_dev->ibd_bd;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  637  	char buf[BDEVNAME_SIZE];
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  638  	ssize_t bl = 0;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  639  
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  640  	if (bd)
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  641  		bl += sprintf(b + bl, "iBlock device: %s",
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  642  				bdevname(bd, buf));
0fd97ccf45be26 Christoph Hellwig         2012-10-08  643  	if (ib_dev->ibd_flags & IBDF_HAS_UDEV_PATH)
44bfd0185043c9 Andy Grover               2012-06-07  644  		bl += sprintf(b + bl, "  UDEV PATH: %s",
0fd97ccf45be26 Christoph Hellwig         2012-10-08  645  				ib_dev->ibd_udev_path);
0fd97ccf45be26 Christoph Hellwig         2012-10-08  646  	bl += sprintf(b + bl, "  readonly: %d\n", ib_dev->ibd_readonly);
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  647  
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  648  	bl += sprintf(b + bl, "        ");
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  649  	if (bd) {
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  650  		bl += sprintf(b + bl, "Major: %d Minor: %d  %s\n",
57ba10592030be Christoph Hellwig         2020-09-03  651  			MAJOR(bd->bd_dev), MINOR(bd->bd_dev),
57ba10592030be Christoph Hellwig         2020-09-03  652  			"CLAIMED: IBLOCK");
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  653  	} else {
21bca31c9678ed Roland Dreier             2011-07-05  654  		bl += sprintf(b + bl, "Major: 0 Minor: 0\n");
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  655  	}
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  656  
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  657  	return bl;
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  658  }
c66ac9db8d4ad9 Nicholas Bellinger        2010-12-17  659  
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  660  static int
fed564f6503bdf Greg Edwards              2018-09-04  661  iblock_alloc_bip(struct se_cmd *cmd, struct bio *bio,
fed564f6503bdf Greg Edwards              2018-09-04 @662  		 struct sg_mapping_iter *miter)
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  663  {
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  664  	struct se_device *dev = cmd->se_dev;
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  665  	struct blk_integrity *bi;
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  666  	struct bio_integrity_payload *bip;
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  667  	struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
fed564f6503bdf Greg Edwards              2018-09-04  668  	int rc;
fed564f6503bdf Greg Edwards              2018-09-04  669  	size_t resid, len;
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  670  
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  671  	bi = bdev_get_integrity(ib_dev->ibd_bd);
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  672  	if (!bi) {
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  673  		pr_err("Unable to locate bio_integrity\n");
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  674  		return -ENODEV;
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  675  	}
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  676  
5f7136db829960 Matthew Wilcox (Oracle    2021-01-29  677) 	bip = bio_integrity_alloc(bio, GFP_NOIO, bio_max_segs(cmd->t_prot_nents));
06c1e3902aa74b Keith Busch               2015-12-03  678  	if (IS_ERR(bip)) {
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  679  		pr_err("Unable to allocate bio_integrity_payload\n");
06c1e3902aa74b Keith Busch               2015-12-03  680  		return PTR_ERR(bip);
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  681  	}
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  682  
fed564f6503bdf Greg Edwards              2018-09-04  683  	bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio));
e4dc9a4c31fe10 Israel Rukshin            2019-12-11  684  	/* virtual start sector must be in integrity interval units */
e4dc9a4c31fe10 Israel Rukshin            2019-12-11  685  	bip_set_seed(bip, bio->bi_iter.bi_sector >>
e4dc9a4c31fe10 Israel Rukshin            2019-12-11  686  				  (bi->interval_exp - SECTOR_SHIFT));
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  687  
4e13c5d0212f25 Linus Torvalds            2014-01-31  688  	pr_debug("IBLOCK BIP Size: %u Sector: %llu\n", bip->bip_iter.bi_size,
4e13c5d0212f25 Linus Torvalds            2014-01-31  689  		 (unsigned long long)bip->bip_iter.bi_sector);
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  690  
fed564f6503bdf Greg Edwards              2018-09-04  691  	resid = bip->bip_iter.bi_size;
fed564f6503bdf Greg Edwards              2018-09-04  692  	while (resid > 0 && sg_miter_next(miter)) {
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  693  
fed564f6503bdf Greg Edwards              2018-09-04  694  		len = min_t(size_t, miter->length, resid);
fed564f6503bdf Greg Edwards              2018-09-04  695  		rc = bio_integrity_add_page(bio, miter->page, len,
fed564f6503bdf Greg Edwards              2018-09-04  696  					    offset_in_page(miter->addr));
fed564f6503bdf Greg Edwards              2018-09-04  697  		if (rc != len) {
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  698  			pr_err("bio_integrity_add_page() failed; %d\n", rc);
fed564f6503bdf Greg Edwards              2018-09-04  699  			sg_miter_stop(miter);
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  700  			return -ENOMEM;
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  701  		}
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  702  
fed564f6503bdf Greg Edwards              2018-09-04  703  		pr_debug("Added bio integrity page: %p length: %zu offset: %lu\n",
fed564f6503bdf Greg Edwards              2018-09-04  704  			  miter->page, len, offset_in_page(miter->addr));
fed564f6503bdf Greg Edwards              2018-09-04  705  
fed564f6503bdf Greg Edwards              2018-09-04  706  		resid -= len;
fed564f6503bdf Greg Edwards              2018-09-04  707  		if (len < miter->length)
fed564f6503bdf Greg Edwards              2018-09-04  708  			miter->consumed -= miter->length - len;
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  709  	}
fed564f6503bdf Greg Edwards              2018-09-04  710  	sg_miter_stop(miter);
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  711  
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  712  	return 0;
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  713  }
ecebbf6ccbca58 Nicholas Bellinger        2013-12-23  714  

:::::: The code at line 662 was first introduced by commit
:::::: fed564f6503bdfd57f6dc32b4a1e94b90b05e803 scsi: target: iblock: split T10 PI SGL across command bios

:::::: TO: Greg Edwards <gedwards@ddn.com>
:::::: CC: Martin K. Petersen <martin.petersen@oracle.com>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37045 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-04 16:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-04 16:41 [hch-block:blkdev.h-includes 8/8] drivers/target/target_core_iblock.c:662:11: warning: declaration of 'struct sg_mapping_iter' will not be visible outside of this function kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.