All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: Inline scsi_mq_alloc_queue()
@ 2021-06-22  2:46 Bart Van Assche
  2021-06-22  4:32 ` Christoph Hellwig
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bart Van Assche @ 2021-06-22  2:46 UTC (permalink / raw)
  To: Martin K . Petersen
  Cc: linux-scsi, Bart Van Assche, Christoph Hellwig, Ming Lei, Ed Tsai

Since scsi_mq_alloc_queue() only has one caller, inline it. This change
was suggested by Christoph Hellwig.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Ed Tsai <ed.tsai@mediatek.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_lib.c  | 12 ------------
 drivers/scsi/scsi_priv.h |  1 -
 drivers/scsi/scsi_scan.c | 12 ++++++++----
 3 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 6b994baf87c2..d1f0ad7c4c36 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1897,18 +1897,6 @@ static const struct blk_mq_ops scsi_mq_ops = {
 	.get_rq_budget_token = scsi_mq_get_rq_budget_token,
 };
 
-struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev)
-{
-	sdev->request_queue = blk_mq_init_queue(&sdev->host->tag_set);
-	if (IS_ERR(sdev->request_queue))
-		return NULL;
-
-	sdev->request_queue->queuedata = sdev;
-	__scsi_init_queue(sdev->host, sdev->request_queue);
-	blk_queue_flag_set(QUEUE_FLAG_SCSI_PASSTHROUGH, sdev->request_queue);
-	return sdev->request_queue;
-}
-
 int scsi_mq_setup_tags(struct Scsi_Host *shost)
 {
 	unsigned int cmd_size, sgl_size;
diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h
index 75d6f23e4fff..eae2235f79b5 100644
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -91,7 +91,6 @@ extern void scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
 extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
 extern void scsi_run_host_queues(struct Scsi_Host *shost);
 extern void scsi_requeue_run_queue(struct work_struct *work);
-extern struct request_queue *scsi_mq_alloc_queue(struct scsi_device *sdev);
 extern void scsi_start_queue(struct scsi_device *sdev);
 extern int scsi_mq_setup_tags(struct Scsi_Host *shost);
 extern void scsi_mq_destroy_tags(struct Scsi_Host *shost);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 5ce45ef9808f..b059bf2b61d4 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -217,6 +217,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 {
 	unsigned int depth;
 	struct scsi_device *sdev;
+	struct request_queue *q;
 	int display_failure_msg = 1, ret;
 	struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
 
@@ -266,16 +267,19 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 	 */
 	sdev->borken = 1;
 
-	sdev->request_queue = scsi_mq_alloc_queue(sdev);
-	if (!sdev->request_queue) {
+	q = blk_mq_init_queue(&sdev->host->tag_set);
+	if (IS_ERR(q)) {
 		/* release fn is set up in scsi_sysfs_device_initialise, so
 		 * have to free and put manually here */
 		put_device(&starget->dev);
 		kfree(sdev);
 		goto out;
 	}
-	WARN_ON_ONCE(!blk_get_queue(sdev->request_queue));
-	sdev->request_queue->queuedata = sdev;
+	sdev->request_queue = q;
+	q->queuedata = sdev;
+	__scsi_init_queue(sdev->host, q);
+	blk_queue_flag_set(QUEUE_FLAG_SCSI_PASSTHROUGH, q);
+	WARN_ON_ONCE(!blk_get_queue(q));
 
 	depth = sdev->host->cmd_per_lun ?: 1;
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: Inline scsi_mq_alloc_queue()
  2021-06-22  2:46 [PATCH] scsi: Inline scsi_mq_alloc_queue() Bart Van Assche
@ 2021-06-22  4:32 ` Christoph Hellwig
  2021-06-22 10:26 ` Ming Lei
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-06-22  4:32 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, Christoph Hellwig, Ming Lei, Ed Tsai

On Mon, Jun 21, 2021 at 07:46:54PM -0700, Bart Van Assche wrote:
> Since scsi_mq_alloc_queue() only has one caller, inline it. This change
> was suggested by Christoph Hellwig.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: Inline scsi_mq_alloc_queue()
  2021-06-22  2:46 [PATCH] scsi: Inline scsi_mq_alloc_queue() Bart Van Assche
  2021-06-22  4:32 ` Christoph Hellwig
@ 2021-06-22 10:26 ` Ming Lei
  2021-06-23  1:18 ` Martin K. Petersen
  2021-06-29  4:10 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Ming Lei @ 2021-06-22 10:26 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, Christoph Hellwig, Ed Tsai

On Tue, Jun 22, 2021 at 10:47 AM Bart Van Assche <bvanassche@acm.org> wrote:
>
> Since scsi_mq_alloc_queue() only has one caller, inline it. This change
> was suggested by Christoph Hellwig.
>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Ed Tsai <ed.tsai@mediatek.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Reviewed-by: Ming Lei <ming.lei@redhat.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: Inline scsi_mq_alloc_queue()
  2021-06-22  2:46 [PATCH] scsi: Inline scsi_mq_alloc_queue() Bart Van Assche
  2021-06-22  4:32 ` Christoph Hellwig
  2021-06-22 10:26 ` Ming Lei
@ 2021-06-23  1:18 ` Martin K. Petersen
  2021-06-29  4:10 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2021-06-23  1:18 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, Christoph Hellwig, Ming Lei, Ed Tsai


Bart,

> Since scsi_mq_alloc_queue() only has one caller, inline it. This
> change was suggested by Christoph Hellwig.

Applied to 5.14/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scsi: Inline scsi_mq_alloc_queue()
  2021-06-22  2:46 [PATCH] scsi: Inline scsi_mq_alloc_queue() Bart Van Assche
                   ` (2 preceding siblings ...)
  2021-06-23  1:18 ` Martin K. Petersen
@ 2021-06-29  4:10 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2021-06-29  4:10 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K . Petersen, linux-scsi, Ed Tsai, Ming Lei, Christoph Hellwig

On Mon, 21 Jun 2021 19:46:54 -0700, Bart Van Assche wrote:

> Since scsi_mq_alloc_queue() only has one caller, inline it. This change
> was suggested by Christoph Hellwig.

Applied to 5.14/scsi-queue, thanks!

[1/1] scsi: Inline scsi_mq_alloc_queue()
      https://git.kernel.org/mkp/scsi/c/59506abe5e34

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-29  4:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22  2:46 [PATCH] scsi: Inline scsi_mq_alloc_queue() Bart Van Assche
2021-06-22  4:32 ` Christoph Hellwig
2021-06-22 10:26 ` Ming Lei
2021-06-23  1:18 ` Martin K. Petersen
2021-06-29  4:10 ` Martin K. Petersen

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.