diff mbox

[2/3] scsi: allow LLDDs to expose the queue mapping to blk-mq

Message ID 1476521241-32765-3-git-send-email-hch@lst.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christoph Hellwig Oct. 15, 2016, 8:47 a.m. UTC
Just hand through the blk-mq map_queues method in the host template.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-mq-cpumap.c    |  1 +
 drivers/scsi/scsi_lib.c  | 10 ++++++++++
 include/scsi/scsi_host.h |  8 ++++++++
 3 files changed, 19 insertions(+)

Comments

Hannes Reinecke Oct. 15, 2016, 11:46 a.m. UTC | #1
On 10/15/2016 10:47 AM, Christoph Hellwig wrote:
> Just hand through the blk-mq map_queues method in the host template.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/blk-mq-cpumap.c    |  1 +
>  drivers/scsi/scsi_lib.c  | 10 ++++++++++
>  include/scsi/scsi_host.h |  8 ++++++++
>  3 files changed, 19 insertions(+)
>
> diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
> index 19b1d9c..8e61e86 100644
> --- a/block/blk-mq-cpumap.c
> +++ b/block/blk-mq-cpumap.c
> @@ -87,6 +87,7 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set)
>  	free_cpumask_var(cpus);
>  	return 0;
>  }
> +EXPORT_SYMBOL_GPL(blk_mq_map_queues);
>
>  /*
>   * We have no quick way of doing reverse lookups. This is only used at
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 2cca9cf..f23ec24 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1990,6 +1990,15 @@ static void scsi_exit_request(void *data, struct request *rq,
>  	kfree(cmd->sense_buffer);
>  }
>
> +static int scsi_map_queues(struct blk_mq_tag_set *set)
> +{
> +	struct Scsi_Host *shost = container_of(set, struct Scsi_Host, tag_set);
> +
> +	if (shost->hostt->map_queues)
> +		return shost->hostt->map_queues(shost);
> +	return blk_mq_map_queues(set);
> +}
> +
>  static u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)
>  {
>  	struct device *host_dev;
> @@ -2082,6 +2091,7 @@ static struct blk_mq_ops scsi_mq_ops = {
>  	.timeout	= scsi_timeout,
>  	.init_request	= scsi_init_request,
>  	.exit_request	= scsi_exit_request,
> +	.map_queues	= scsi_map_queues,
>  };
>
>  struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev)
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index 7e4cd53..36680f1 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -278,6 +278,14 @@ struct scsi_host_template {
>  	int (* change_queue_depth)(struct scsi_device *, int);
>
>  	/*
> +	 * This functions lets the driver expose the queue mapping
> +	 * to the block layer.
> +	 *
> +	 * Status: OPTIONAL
> +	 */
> +	int (* map_queues)(struct Scsi_Host *shost);
> +
> +	/*
>  	 * This function determines the BIOS parameters for a given
>  	 * harddisk.  These tend to be numbers that are made up by
>  	 * the host adapter.  Parameters:
>
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
Johannes Thumshirn Oct. 17, 2016, 7:27 a.m. UTC | #2
On Sat, Oct 15, 2016 at 10:47:20AM +0200, Christoph Hellwig wrote:
> Just hand through the blk-mq map_queues method in the host template.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/blk-mq-cpumap.c    |  1 +
>  drivers/scsi/scsi_lib.c  | 10 ++++++++++
>  include/scsi/scsi_host.h |  8 ++++++++
>  3 files changed, 19 insertions(+)
> 
> diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
> index 19b1d9c..8e61e86 100644
> --- a/block/blk-mq-cpumap.c
> +++ b/block/blk-mq-cpumap.c
> @@ -87,6 +87,7 @@ int blk_mq_map_queues(struct blk_mq_tag_set *set)
>  	free_cpumask_var(cpus);
>  	return 0;
>  }
> +EXPORT_SYMBOL_GPL(blk_mq_map_queues);
>  
>  /*
>   * We have no quick way of doing reverse lookups. This is only used at

Shouldn't this hunk go into the previous patch?

Otherwise,

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Christoph Hellwig Oct. 17, 2016, 7:44 a.m. UTC | #3
On Mon, Oct 17, 2016 at 09:27:03AM +0200, Johannes Thumshirn wrote:
> Shouldn't this hunk go into the previous patch?

Yes, it should, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/block/blk-mq-cpumap.c b/block/blk-mq-cpumap.c
index 19b1d9c..8e61e86 100644
--- a/block/blk-mq-cpumap.c
+++ b/block/blk-mq-cpumap.c
@@ -87,6 +87,7 @@  int blk_mq_map_queues(struct blk_mq_tag_set *set)
 	free_cpumask_var(cpus);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(blk_mq_map_queues);
 
 /*
  * We have no quick way of doing reverse lookups. This is only used at
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 2cca9cf..f23ec24 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1990,6 +1990,15 @@  static void scsi_exit_request(void *data, struct request *rq,
 	kfree(cmd->sense_buffer);
 }
 
+static int scsi_map_queues(struct blk_mq_tag_set *set)
+{
+	struct Scsi_Host *shost = container_of(set, struct Scsi_Host, tag_set);
+
+	if (shost->hostt->map_queues)
+		return shost->hostt->map_queues(shost);
+	return blk_mq_map_queues(set);
+}
+
 static u64 scsi_calculate_bounce_limit(struct Scsi_Host *shost)
 {
 	struct device *host_dev;
@@ -2082,6 +2091,7 @@  static struct blk_mq_ops scsi_mq_ops = {
 	.timeout	= scsi_timeout,
 	.init_request	= scsi_init_request,
 	.exit_request	= scsi_exit_request,
+	.map_queues	= scsi_map_queues,
 };
 
 struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 7e4cd53..36680f1 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -278,6 +278,14 @@  struct scsi_host_template {
 	int (* change_queue_depth)(struct scsi_device *, int);
 
 	/*
+	 * This functions lets the driver expose the queue mapping
+	 * to the block layer.
+	 *
+	 * Status: OPTIONAL
+	 */
+	int (* map_queues)(struct Scsi_Host *shost);
+
+	/*
 	 * This function determines the BIOS parameters for a given
 	 * harddisk.  These tend to be numbers that are made up by
 	 * the host adapter.  Parameters: