Subject: Re: [PATCH 2/2] scsi: core: fix dh and multipathing for SCSI hosts without request batching

From: kbuild test robot <[email-masked]>
Date: Thu, 8 Aug 2019 14:02:59 +0800

Hi Steffen,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc3 next-20190807]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Steffen-Maier/scsi-core-fix-missing-cleanup_rq-for-SCSI-hosts-without-request-batching/20190808-052017
config: riscv-defconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=riscv 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email-masked]>

All errors (new ones prefixed by >>):

   drivers/scsi/scsi_lib.c:1824:3: error: 'const struct blk_mq_ops' has no member named 'cleanup_rq'; did you mean 'queue_rq'?
     .cleanup_rq = scsi_cleanup_rq,
      ^~~~~~~~~~
      queue_rq
   drivers/scsi/scsi_lib.c:1824:16: error: 'scsi_cleanup_rq' undeclared here (not in a function); did you mean 'scsi_queue_rq'?
     .cleanup_rq = scsi_cleanup_rq,
                   ^~~~~~~~~~~~~~~
                   scsi_queue_rq
   drivers/scsi/scsi_lib.c: In function 'scsi_device_from_queue':
>> drivers/scsi/scsi_lib.c:1881:20: error: 'scsi_mq_ops_no_commit' undeclared (first use in this function); did you mean 'scsi_mq_ops'?
     if (q->mq_ops == &scsi_mq_ops_no_commit ||
                       ^~~~~~~~~~~~~~~~~~~~~
                       scsi_mq_ops
   drivers/scsi/scsi_lib.c:1881:20: note: each undeclared identifier is reported only once for each function it appears in

vim +1881 drivers/scsi/scsi_lib.c

  1811	
  1812	static const struct blk_mq_ops scsi_mq_ops = {
  1813		.get_budget	= scsi_mq_get_budget,
  1814		.put_budget	= scsi_mq_put_budget,
  1815		.queue_rq	= scsi_queue_rq,
  1816		.complete	= scsi_softirq_done,
  1817		.timeout	= scsi_timeout,
  1818	#ifdef CONFIG_BLK_DEBUG_FS
  1819		.show_rq	= scsi_show_rq,
  1820	#endif
  1821		.init_request	= scsi_mq_init_request,
  1822		.exit_request	= scsi_mq_exit_request,
  1823		.initialize_rq_fn = scsi_initialize_rq,
> 1824		.cleanup_rq	= scsi_cleanup_rq,
  1825		.busy		= scsi_mq_lld_busy,
  1826		.map_queues	= scsi_map_queues,
  1827	};
  1828	
  1829	struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev)
  1830	{
  1831		sdev->request_queue = blk_mq_init_queue(&sdev->host->tag_set);
  1832		if (IS_ERR(sdev->request_queue))
  1833			return NULL;
  1834	
  1835		sdev->request_queue->queuedata = sdev;
  1836		__scsi_init_queue(sdev->host, sdev->request_queue);
  1837		blk_queue_flag_set(QUEUE_FLAG_SCSI_PASSTHROUGH, sdev->request_queue);
  1838		return sdev->request_queue;
  1839	}
  1840	
  1841	int scsi_mq_setup_tags(struct Scsi_Host *shost)
  1842	{
  1843		unsigned int cmd_size, sgl_size;
  1844	
  1845		sgl_size = scsi_mq_inline_sgl_size(shost);
  1846		cmd_size = sizeof(struct scsi_cmnd) + shost->hostt->cmd_size + sgl_size;
  1847		if (scsi_host_get_prot(shost))
  1848			cmd_size += sizeof(struct scsi_data_buffer) +
  1849				sizeof(struct scatterlist) * SCSI_INLINE_PROT_SG_CNT;
  1850	
  1851		memset(&shost->tag_set, 0, sizeof(shost->tag_set));
  1852		shost->tag_set.ops = &scsi_mq_ops;
  1853		shost->tag_set.nr_hw_queues = shost->nr_hw_queues ? : 1;
  1854		shost->tag_set.queue_depth = shost->can_queue;
  1855		shost->tag_set.cmd_size = cmd_size;
  1856		shost->tag_set.numa_node = NUMA_NO_NODE;
  1857		shost->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
  1858		shost->tag_set.flags |=
  1859			BLK_ALLOC_POLICY_TO_MQ_FLAG(shost->hostt->tag_alloc_policy);
  1860		shost->tag_set.driver_data = shost;
  1861	
  1862		return blk_mq_alloc_tag_set(&shost->tag_set);
  1863	}
  1864	
  1865	void scsi_mq_destroy_tags(struct Scsi_Host *shost)
  1866	{
  1867		blk_mq_free_tag_set(&shost->tag_set);
  1868	}
  1869	
  1870	/**
  1871	 * scsi_device_from_queue - return sdev associated with a request_queue
  1872	 * @q: The request queue to return the sdev from
  1873	 *
  1874	 * Return the sdev associated with a request queue or NULL if the
  1875	 * request_queue does not reference a SCSI device.
  1876	 */
  1877	struct scsi_device *scsi_device_from_queue(struct request_queue *q)
  1878	{
  1879		struct scsi_device *sdev = NULL;
  1880	
> 1881		if (q->mq_ops == &scsi_mq_ops_no_commit ||
  1882		    q->mq_ops == &scsi_mq_ops)
  1883			sdev = q->queuedata;
  1884		if (!sdev || !get_device(&sdev->sdev_gendev))
  1885			sdev = NULL;
  1886	
  1887		return sdev;
  1888	}
  1889	EXPORT_SYMBOL_GPL(scsi_device_from_queue);
  1890	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation