Linux block layer
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: martin.petersen@oracle.com, don.brace@microsemi.com
Cc: axboe@kernel.dk, linux-scsi@vger.kernel.org, linux-block@vger.kernel.org
Subject: [PATCH 2/3] scsi: allow LLDDs to expose the queue mapping to blk-mq
Date: Sat, 15 Oct 2016 10:47:20 +0200	[thread overview]
Message-ID: <1476521241-32765-3-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1476521241-32765-1-git-send-email-hch@lst.de>

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:
-- 
2.1.4

  parent reply	other threads:[~2016-10-15  8:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15  8:47 expose queue the queue mapping for SCSI drivers Christoph Hellwig
2016-10-15  8:47 ` [PATCH 1/3] blk-mq: export blk_mq_map_queues Christoph Hellwig
2016-10-15 11:45   ` Hannes Reinecke
2016-10-17  7:29   ` Johannes Thumshirn
2016-10-15  8:47 ` Christoph Hellwig [this message]
2016-10-15 11:46   ` [PATCH 2/3] scsi: allow LLDDs to expose the queue mapping to blk-mq Hannes Reinecke
2016-10-17  7:27   ` Johannes Thumshirn
2016-10-17  7:44     ` Christoph Hellwig
2016-10-15  8:47 ` [PATCH 3/3] smartpqi: switch to pci_alloc_irq_vectors Christoph Hellwig
2016-10-15 11:47   ` Hannes Reinecke
2016-10-17  7:34   ` Johannes Thumshirn
2016-10-17 13:44     ` Don Brace
2016-10-17 14:20       ` Christoph Hellwig
2016-10-17 16:34         ` Don Brace
2016-10-31 19:32     ` Don Brace
2016-10-15 11:45 ` expose queue the queue mapping for SCSI drivers Hannes Reinecke
  -- strict thread matches above, loose matches on Subject: below --
2016-11-01 14:12 expose queue the queue mapping for SCSI drivers V2 Christoph Hellwig
2016-11-01 14:12 ` [PATCH 2/3] scsi: allow LLDDs to expose the queue mapping to blk-mq Christoph Hellwig
2016-11-01 16:01   ` Sagi Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476521241-32765-3-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=don.brace@microsemi.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox