From: Can Guo <cang@codeaurora.org>
To: Bart Van Assche <bvanassche@acm.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
Ming Lei <ming.lei@redhat.com>,
linux-scsi@vger.kernel.org, linux-block@vger.kernel.org,
Alan Stern <stern@rowland.harvard.edu>,
Stanley Chu <stanley.chu@mediatek.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH v3 4/9] scsi: Inline scsi_mq_alloc_queue()
Date: Tue, 24 Nov 2020 17:49:47 +0800 [thread overview]
Message-ID: <4c1b1cf7d3f2a5fa3e479735303b9c59@codeaurora.org> (raw)
In-Reply-To: <20201123031749.14912-5-bvanassche@acm.org>
On 2020-11-23 11:17, Bart Van Assche 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: Alan Stern <stern@rowland.harvard.edu>
> Cc: Can Guo <cang@codeaurora.org>
> Cc: Stanley Chu <stanley.chu@mediatek.com>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Can Guo <cang@codeaurora.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 a7252df74c7b..b5449efc7283 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -1881,18 +1881,6 @@ static const struct blk_mq_ops scsi_mq_ops = {
> .map_queues = scsi_map_queues,
> };
>
> -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 180636d54982..e34755986b47 100644
> --- a/drivers/scsi/scsi_priv.h
> +++ b/drivers/scsi/scsi_priv.h
> @@ -90,7 +90,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 f2437a7570ce..43416e7259a7 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -216,6 +216,7 @@ static struct scsi_device *scsi_alloc_sdev(struct
> scsi_target *starget,
> u64 lun, void *hostdata)
> {
> struct scsi_device *sdev;
> + struct request_queue *q;
> int display_failure_msg = 1, ret;
> struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
>
> @@ -265,16 +266,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));
>
> scsi_change_queue_depth(sdev, sdev->host->cmd_per_lun ?
> sdev->host->cmd_per_lun : 1);
next prev parent reply other threads:[~2020-11-24 9:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-23 3:17 [PATCH v3 0/9] Rework runtime suspend and SCSI domain validation Bart Van Assche
2020-11-23 3:17 ` [PATCH v3 1/9] block: Fix a race in the runtime power management code Bart Van Assche
2020-11-23 6:46 ` Hannes Reinecke
2020-11-23 3:17 ` [PATCH v3 2/9] ide: Do not set the RQF_PREEMPT flag for sense requests Bart Van Assche
2020-11-23 6:47 ` Hannes Reinecke
2020-11-23 3:17 ` [PATCH v3 3/9] scsi: Pass a request queue pointer to __scsi_execute() Bart Van Assche
2020-11-23 3:17 ` [PATCH v3 4/9] scsi: Inline scsi_mq_alloc_queue() Bart Van Assche
2020-11-24 9:14 ` Christoph Hellwig
2020-11-24 9:49 ` Can Guo [this message]
2020-11-23 3:17 ` [PATCH v3 5/9] scsi: Do not wait for a request in scsi_eh_lock_door() Bart Van Assche
2020-11-23 3:17 ` [PATCH v3 6/9] scsi_transport_spi: Make spi_execute() accept a request queue pointer Bart Van Assche
2020-11-23 3:17 ` [PATCH v3 7/9] scsi_transport_spi: Freeze request queues instead of quiescing Bart Van Assche
2020-11-23 7:02 ` Hannes Reinecke
2020-11-24 5:09 ` Bart Van Assche
2020-11-24 7:13 ` Hannes Reinecke
2020-11-23 3:17 ` [PATCH v3 8/9] block, scsi, ide: Only process PM requests if rpm_status != RPM_ACTIVE Bart Van Assche
2020-11-23 3:17 ` [PATCH v3 9/9] block: Do not accept any requests while suspended Bart Van Assche
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=4c1b1cf7d3f2a5fa3e479735303b9c59@codeaurora.org \
--to=cang@codeaurora.org \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hch@lst.de \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=ming.lei@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=stanley.chu@mediatek.com \
--cc=stern@rowland.harvard.edu \
/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