diff mbox series

[1/2] scsi: core: Pass sdev to blk_mq_alloc_queue()

Message ID 20240524084829.2132555-2-john.g.garry@oracle.com
State New
Headers show
Series block, scsi: Small improvements for blk_mq_alloc_queue() usage | expand

Commit Message

John Garry May 24, 2024, 8:48 a.m. UTC
When calling scsi_alloc_sdev() -> blk_mq_alloc_queue(), we don't pass
the sdev as the queuedata, but rather manually set it afterwards. Just
pass to blk_mq_alloc_queue() to have automatically set.

Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 drivers/scsi/scsi_scan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Christoph Hellwig May 24, 2024, 9:38 a.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Hannes Reinecke May 24, 2024, 10:26 a.m. UTC | #2
On 5/24/24 10:48, John Garry wrote:
> When calling scsi_alloc_sdev() -> blk_mq_alloc_queue(), we don't pass
> the sdev as the queuedata, but rather manually set it afterwards. Just
> pass to blk_mq_alloc_queue() to have automatically set.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>   drivers/scsi/scsi_scan.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index 463ce6e23dc6..ec54d58fb6c0 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -334,7 +334,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
>   	sdev->sg_reserved_size = INT_MAX;
>   
>   	scsi_init_limits(shost, &lim);
> -	q = blk_mq_alloc_queue(&sdev->host->tag_set, &lim, NULL);
> +	q = blk_mq_alloc_queue(&sdev->host->tag_set, &lim, sdev);
>   	if (IS_ERR(q)) {
>   		/* release fn is set up in scsi_sysfs_device_initialise, so
>   		 * have to free and put manually here */
> @@ -344,7 +344,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
>   	}
>   	kref_get(&sdev->host->tagset_refcnt);
>   	sdev->request_queue = q;
> -	q->queuedata = sdev;
>   
>   	depth = sdev->host->cmd_per_lun ?: 1;
>   
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Hannes Reinecke June 11, 2024, 6:21 a.m. UTC | #3
On 5/24/24 10:48, John Garry wrote:
> When calling scsi_alloc_sdev() -> blk_mq_alloc_queue(), we don't pass
> the sdev as the queuedata, but rather manually set it afterwards. Just
> pass to blk_mq_alloc_queue() to have automatically set.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>   drivers/scsi/scsi_scan.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 463ce6e23dc6..ec54d58fb6c0 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -334,7 +334,7 @@  static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 	sdev->sg_reserved_size = INT_MAX;
 
 	scsi_init_limits(shost, &lim);
-	q = blk_mq_alloc_queue(&sdev->host->tag_set, &lim, NULL);
+	q = blk_mq_alloc_queue(&sdev->host->tag_set, &lim, sdev);
 	if (IS_ERR(q)) {
 		/* release fn is set up in scsi_sysfs_device_initialise, so
 		 * have to free and put manually here */
@@ -344,7 +344,6 @@  static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 	}
 	kref_get(&sdev->host->tagset_refcnt);
 	sdev->request_queue = q;
-	q->queuedata = sdev;
 
 	depth = sdev->host->cmd_per_lun ?: 1;