linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage
@ 2024-05-24  8:48 John Garry
  2024-05-24  8:48 ` [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue() John Garry
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: John Garry @ 2024-05-24  8:48 UTC (permalink / raw)
  To: axboe, martin.petersen, James.Bottomley, hch
  Cc: linux-block, linux-scsi, himanshu.madhani, John Garry

A couple of small improvements to not manually set q->queuedata.

I asked Himanshu (cc'ed) to test the bsg-lib.c change as I have no setup
to test.

Based on mkp-scsi 6.10 staging queue at e4f5f8298cf6.

John Garry (2):
  scsi: core: Pass sdev to blk_mq_alloc_queue()
  scsi: bsg: Pass dev to blk_mq_alloc_queue()

 block/bsg-lib.c          | 3 +--
 drivers/scsi/scsi_scan.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

-- 
2.31.1


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

* [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue()
  2024-05-24  8:48 [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage John Garry
@ 2024-05-24  8:48 ` John Garry
  2024-05-24  9:38   ` Christoph Hellwig
                     ` (2 more replies)
  2024-05-24  8:48 ` [PATCH 2/2] scsi: bsg: Pass dev " John Garry
                   ` (3 subsequent siblings)
  4 siblings, 3 replies; 11+ messages in thread
From: John Garry @ 2024-05-24  8:48 UTC (permalink / raw)
  To: axboe, martin.petersen, James.Bottomley, hch
  Cc: linux-block, linux-scsi, himanshu.madhani, John Garry

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;
 
-- 
2.31.1


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

* [PATCH 2/2] scsi: bsg: Pass dev to blk_mq_alloc_queue()
  2024-05-24  8:48 [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage John Garry
  2024-05-24  8:48 ` [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue() John Garry
@ 2024-05-24  8:48 ` John Garry
  2024-05-24  9:38   ` Christoph Hellwig
  2024-05-24 10:26   ` Hannes Reinecke
  2024-05-29 20:30 ` [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage Himanshu Madhani
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 11+ messages in thread
From: John Garry @ 2024-05-24  8:48 UTC (permalink / raw)
  To: axboe, martin.petersen, James.Bottomley, hch
  Cc: linux-block, linux-scsi, himanshu.madhani, John Garry

When calling bsg_setup_queue() -> blk_mq_alloc_queue(), we don't pass
the dev as the queuedata, but rather manually set it afterwards. Just
pass dev to blk_mq_alloc_queue() to have automatically set.

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

diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index ee738d129a9f..32da4a4429ce 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -385,13 +385,12 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
 	if (blk_mq_alloc_tag_set(set))
 		goto out_tag_set;
 
-	q = blk_mq_alloc_queue(set, lim, NULL);
+	q = blk_mq_alloc_queue(set, lim, dev);
 	if (IS_ERR(q)) {
 		ret = PTR_ERR(q);
 		goto out_queue;
 	}
 
-	q->queuedata = dev;
 	blk_queue_rq_timeout(q, BLK_DEFAULT_SG_TIMEOUT);
 
 	bset->bd = bsg_register_queue(q, dev, name, bsg_transport_sg_io_fn);
-- 
2.31.1


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

* Re: [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue()
  2024-05-24  8:48 ` [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue() John Garry
@ 2024-05-24  9:38   ` Christoph Hellwig
  2024-05-24 10:26   ` Hannes Reinecke
  2024-06-11  6:21   ` Hannes Reinecke
  2 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2024-05-24  9:38 UTC (permalink / raw)
  To: John Garry
  Cc: axboe, martin.petersen, James.Bottomley, hch, linux-block,
	linux-scsi, himanshu.madhani

Looks good:

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

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

* Re: [PATCH 2/2] scsi: bsg: Pass dev to blk_mq_alloc_queue()
  2024-05-24  8:48 ` [PATCH 2/2] scsi: bsg: Pass dev " John Garry
@ 2024-05-24  9:38   ` Christoph Hellwig
  2024-05-24 10:26   ` Hannes Reinecke
  1 sibling, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2024-05-24  9:38 UTC (permalink / raw)
  To: John Garry
  Cc: axboe, martin.petersen, James.Bottomley, hch, linux-block,
	linux-scsi, himanshu.madhani

Looks good:

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

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

* Re: [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue()
  2024-05-24  8:48 ` [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue() John Garry
  2024-05-24  9:38   ` Christoph Hellwig
@ 2024-05-24 10:26   ` Hannes Reinecke
  2024-06-11  6:21   ` Hannes Reinecke
  2 siblings, 0 replies; 11+ messages in thread
From: Hannes Reinecke @ 2024-05-24 10:26 UTC (permalink / raw)
  To: John Garry, axboe, martin.petersen, James.Bottomley, hch
  Cc: linux-block, linux-scsi, himanshu.madhani

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


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

* Re: [PATCH 2/2] scsi: bsg: Pass dev to blk_mq_alloc_queue()
  2024-05-24  8:48 ` [PATCH 2/2] scsi: bsg: Pass dev " John Garry
  2024-05-24  9:38   ` Christoph Hellwig
@ 2024-05-24 10:26   ` Hannes Reinecke
  1 sibling, 0 replies; 11+ messages in thread
From: Hannes Reinecke @ 2024-05-24 10:26 UTC (permalink / raw)
  To: John Garry, axboe, martin.petersen, James.Bottomley, hch
  Cc: linux-block, linux-scsi, himanshu.madhani

On 5/24/24 10:48, John Garry wrote:
> When calling bsg_setup_queue() -> blk_mq_alloc_queue(), we don't pass
> the dev as the queuedata, but rather manually set it afterwards. Just
> pass dev to blk_mq_alloc_queue() to have automatically set.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>   block/bsg-lib.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/bsg-lib.c b/block/bsg-lib.c
> index ee738d129a9f..32da4a4429ce 100644
> --- a/block/bsg-lib.c
> +++ b/block/bsg-lib.c
> @@ -385,13 +385,12 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
>   	if (blk_mq_alloc_tag_set(set))
>   		goto out_tag_set;
>   
> -	q = blk_mq_alloc_queue(set, lim, NULL);
> +	q = blk_mq_alloc_queue(set, lim, dev);
>   	if (IS_ERR(q)) {
>   		ret = PTR_ERR(q);
>   		goto out_queue;
>   	}
>   
> -	q->queuedata = dev;
>   	blk_queue_rq_timeout(q, BLK_DEFAULT_SG_TIMEOUT);
>   
>   	bset->bd = bsg_register_queue(q, dev, name, bsg_transport_sg_io_fn);

Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes


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

* Re: [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage
  2024-05-24  8:48 [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage John Garry
  2024-05-24  8:48 ` [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue() John Garry
  2024-05-24  8:48 ` [PATCH 2/2] scsi: bsg: Pass dev " John Garry
@ 2024-05-29 20:30 ` Himanshu Madhani
  2024-05-31  0:23 ` Martin K. Petersen
  2024-06-05  2:32 ` Martin K. Petersen
  4 siblings, 0 replies; 11+ messages in thread
From: Himanshu Madhani @ 2024-05-29 20:30 UTC (permalink / raw)
  To: John Garry, axboe, martin.petersen, James.Bottomley, hch
  Cc: linux-block, linux-scsi



On 5/24/24 01:48, John Garry wrote:
> A couple of small improvements to not manually set q->queuedata.
> 
> I asked Himanshu (cc'ed) to test the bsg-lib.c change as I have no setup
> to test.
> 
> Based on mkp-scsi 6.10 staging queue at e4f5f8298cf6.
> 
> John Garry (2):
>    scsi: core: Pass sdev to blk_mq_alloc_queue()
>    scsi: bsg: Pass dev to blk_mq_alloc_queue()
> 
>   block/bsg-lib.c          | 3 +--
>   drivers/scsi/scsi_scan.c | 3 +--
>   2 files changed, 2 insertions(+), 4 deletions(-)
> 

Changes looks good for this series. I tested basic driver load/unload, 
as my setup is not connected to any Switch.

Tested-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

-- 
Himanshu Madhani                                Oracle Linux Engineering

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

* Re: [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage
  2024-05-24  8:48 [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage John Garry
                   ` (2 preceding siblings ...)
  2024-05-29 20:30 ` [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage Himanshu Madhani
@ 2024-05-31  0:23 ` Martin K. Petersen
  2024-06-05  2:32 ` Martin K. Petersen
  4 siblings, 0 replies; 11+ messages in thread
From: Martin K. Petersen @ 2024-05-31  0:23 UTC (permalink / raw)
  To: John Garry
  Cc: axboe, martin.petersen, James.Bottomley, hch, linux-block,
	linux-scsi, himanshu.madhani


John,

> A couple of small improvements to not manually set q->queuedata.

Applied to 6.11/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage
  2024-05-24  8:48 [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage John Garry
                   ` (3 preceding siblings ...)
  2024-05-31  0:23 ` Martin K. Petersen
@ 2024-06-05  2:32 ` Martin K. Petersen
  4 siblings, 0 replies; 11+ messages in thread
From: Martin K. Petersen @ 2024-06-05  2:32 UTC (permalink / raw)
  To: axboe, James.Bottomley, hch, John Garry
  Cc: Martin K . Petersen, linux-block, linux-scsi, himanshu.madhani

On Fri, 24 May 2024 08:48:27 +0000, John Garry wrote:

> A couple of small improvements to not manually set q->queuedata.
> 
> I asked Himanshu (cc'ed) to test the bsg-lib.c change as I have no setup
> to test.
> 
> Based on mkp-scsi 6.10 staging queue at e4f5f8298cf6.
> 
> [...]

Applied to 6.11/scsi-queue, thanks!

[1/2] scsi: core: Pass sdev to blk_mq_alloc_queue()
      https://git.kernel.org/mkp/scsi/c/e7c09df178f7
[2/2] scsi: bsg: Pass dev to blk_mq_alloc_queue()
      https://git.kernel.org/mkp/scsi/c/41b757425203

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue()
  2024-05-24  8:48 ` [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue() John Garry
  2024-05-24  9:38   ` Christoph Hellwig
  2024-05-24 10:26   ` Hannes Reinecke
@ 2024-06-11  6:21   ` Hannes Reinecke
  2 siblings, 0 replies; 11+ messages in thread
From: Hannes Reinecke @ 2024-06-11  6:21 UTC (permalink / raw)
  To: John Garry, axboe, martin.petersen, James.Bottomley, hch
  Cc: linux-block, linux-scsi, himanshu.madhani

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
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich


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

end of thread, other threads:[~2024-06-11  6:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-24  8:48 [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage John Garry
2024-05-24  8:48 ` [PATCH 1/2] scsi: core: Pass sdev to blk_mq_alloc_queue() John Garry
2024-05-24  9:38   ` Christoph Hellwig
2024-05-24 10:26   ` Hannes Reinecke
2024-06-11  6:21   ` Hannes Reinecke
2024-05-24  8:48 ` [PATCH 2/2] scsi: bsg: Pass dev " John Garry
2024-05-24  9:38   ` Christoph Hellwig
2024-05-24 10:26   ` Hannes Reinecke
2024-05-29 20:30 ` [PATCH 0/2] block, scsi: Small improvements for blk_mq_alloc_queue() usage Himanshu Madhani
2024-05-31  0:23 ` Martin K. Petersen
2024-06-05  2:32 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).