Linux-SCSI Archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Damien Le Moal <dlemoal@kernel.org>,
	Niklas Cassel <cassel@kernel.org>,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Sreekanth Reddy <sreekanth.reddy@broadcom.com>,
	Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
	"Juergen E. Fischer" <fischer@norbit.de>,
	Xiang Chen <chenxiang66@hisilicon.com>,
	HighPoint Linux Team <linux@highpoint-tech.com>,
	Tyrel Datwyler <tyreld@linux.ibm.com>,
	Brian King <brking@us.ibm.com>, Lee Duncan <lduncan@suse.com>,
	Chris Leech <cleech@redhat.com>,
	Mike Christie <michael.christie@oracle.com>,
	John Garry <john.g.garry@oracle.com>,
	Jason Yan <yanaijie@huawei.com>,
	Kashyap Desai <kashyap.desai@broadcom.com>,
	Sumit Saxena <sumit.saxena@broadcom.com>,
	Shivasharan S <shivasharan.srikanteshwara@broadcom.com>,
	Chandrakanth patil <chandrakanth.patil@broadcom.com>,
	Jack Wang <jinpu.wang@cloud.ionos.com>,
	Nilesh Javali <njavali@marvell.com>,
	GR-QLogic-Storage-Upstream@marvell.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-block@vger.kernel.org, linux-ide@vger.kernel.org,
	linux1394-devel@lists.sourceforge.net,
	MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org,
	megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com,
	linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org,
	usb-storage@lists.one-eyed-alien.net
Subject: [PATCH 02/23] bsg: pass queue_limits to bsg_setup_queue
Date: Tue,  2 Apr 2024 15:06:24 +0200	[thread overview]
Message-ID: <20240402130645.653507-3-hch@lst.de> (raw)
In-Reply-To: <20240402130645.653507-1-hch@lst.de>

This allows bsg_setup_queue to pass them to blk_mq_alloc_queue and thus
set up the limits at queue allocation time.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
---
 block/bsg-lib.c                     | 6 ++++--
 drivers/scsi/mpi3mr/mpi3mr_app.c    | 2 +-
 drivers/scsi/scsi_transport_fc.c    | 6 +++---
 drivers/scsi/scsi_transport_iscsi.c | 3 ++-
 drivers/scsi/scsi_transport_sas.c   | 4 ++--
 drivers/ufs/core/ufs_bsg.c          | 3 ++-
 include/linux/bsg-lib.h             | 3 ++-
 7 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/block/bsg-lib.c b/block/bsg-lib.c
index bcc7dee6abced6..ee738d129a9f5e 100644
--- a/block/bsg-lib.c
+++ b/block/bsg-lib.c
@@ -354,12 +354,14 @@ static const struct blk_mq_ops bsg_mq_ops = {
  * bsg_setup_queue - Create and add the bsg hooks so we can receive requests
  * @dev: device to attach bsg device to
  * @name: device to give bsg device
+ * @lim: queue limits for the bsg queue
  * @job_fn: bsg job handler
  * @timeout: timeout handler function pointer
  * @dd_job_size: size of LLD data needed for each job
  */
 struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
-		bsg_job_fn *job_fn, bsg_timeout_fn *timeout, int dd_job_size)
+		struct queue_limits *lim, bsg_job_fn *job_fn,
+		bsg_timeout_fn *timeout, int dd_job_size)
 {
 	struct bsg_set *bset;
 	struct blk_mq_tag_set *set;
@@ -383,7 +385,7 @@ 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, NULL, NULL);
+	q = blk_mq_alloc_queue(set, lim, NULL);
 	if (IS_ERR(q)) {
 		ret = PTR_ERR(q);
 		goto out_queue;
diff --git a/drivers/scsi/mpi3mr/mpi3mr_app.c b/drivers/scsi/mpi3mr/mpi3mr_app.c
index 55d590b919476e..ce5445eb9d0e4e 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_app.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_app.c
@@ -1853,7 +1853,7 @@ void mpi3mr_bsg_init(struct mpi3mr_ioc *mrioc)
 		return;
 	}
 
-	mrioc->bsg_queue = bsg_setup_queue(bsg_dev, dev_name(bsg_dev),
+	mrioc->bsg_queue = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), NULL,
 			mpi3mr_bsg_request, NULL, 0);
 	if (IS_ERR(mrioc->bsg_queue)) {
 		ioc_err(mrioc, "%s: bsg registration failed\n",
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index b04075f19445dc..87b2235b8ece45 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -4287,8 +4287,8 @@ fc_bsg_hostadd(struct Scsi_Host *shost, struct fc_host_attrs *fc_host)
 	snprintf(bsg_name, sizeof(bsg_name),
 		 "fc_host%d", shost->host_no);
 
-	q = bsg_setup_queue(dev, bsg_name, fc_bsg_dispatch, fc_bsg_job_timeout,
-				i->f->dd_bsg_size);
+	q = bsg_setup_queue(dev, bsg_name, NULL, fc_bsg_dispatch,
+			fc_bsg_job_timeout, i->f->dd_bsg_size);
 	if (IS_ERR(q)) {
 		dev_err(dev,
 			"fc_host%d: bsg interface failed to initialize - setup queue\n",
@@ -4318,7 +4318,7 @@ fc_bsg_rportadd(struct Scsi_Host *shost, struct fc_rport *rport)
 	if (!i->f->bsg_request)
 		return -ENOTSUPP;
 
-	q = bsg_setup_queue(dev, dev_name(dev), fc_bsg_dispatch_prep,
+	q = bsg_setup_queue(dev, dev_name(dev), NULL, fc_bsg_dispatch_prep,
 				fc_bsg_job_timeout, i->f->dd_bsg_size);
 	if (IS_ERR(q)) {
 		dev_err(dev, "failed to setup bsg queue\n");
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index af3ac6346796ba..c131746bf20777 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1542,7 +1542,8 @@ iscsi_bsg_host_add(struct Scsi_Host *shost, struct iscsi_cls_host *ihost)
 		return -ENOTSUPP;
 
 	snprintf(bsg_name, sizeof(bsg_name), "iscsi_host%d", shost->host_no);
-	q = bsg_setup_queue(dev, bsg_name, iscsi_bsg_host_dispatch, NULL, 0);
+	q = bsg_setup_queue(dev, bsg_name, NULL, iscsi_bsg_host_dispatch, NULL,
+			0);
 	if (IS_ERR(q)) {
 		shost_printk(KERN_ERR, shost, "bsg interface failed to "
 			     "initialize - no request queue\n");
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
index d704c484a251c5..424a89513814b4 100644
--- a/drivers/scsi/scsi_transport_sas.c
+++ b/drivers/scsi/scsi_transport_sas.c
@@ -197,7 +197,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
 	}
 
 	if (rphy) {
-		q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev),
+		q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev), NULL,
 				sas_smp_dispatch, NULL, 0);
 		if (IS_ERR(q))
 			return PTR_ERR(q);
@@ -206,7 +206,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
 		char name[20];
 
 		snprintf(name, sizeof(name), "sas_host%d", shost->host_no);
-		q = bsg_setup_queue(&shost->shost_gendev, name,
+		q = bsg_setup_queue(&shost->shost_gendev, name, NULL,
 				sas_smp_dispatch, NULL, 0);
 		if (IS_ERR(q))
 			return PTR_ERR(q);
diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c
index 374e5aae4e7e86..433d0480391ea6 100644
--- a/drivers/ufs/core/ufs_bsg.c
+++ b/drivers/ufs/core/ufs_bsg.c
@@ -253,7 +253,8 @@ int ufs_bsg_probe(struct ufs_hba *hba)
 	if (ret)
 		goto out;
 
-	q = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), ufs_bsg_request, NULL, 0);
+	q = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), NULL, ufs_bsg_request,
+			NULL, 0);
 	if (IS_ERR(q)) {
 		ret = PTR_ERR(q);
 		goto out;
diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h
index 9e97ced2896df2..14fa93268630ed 100644
--- a/include/linux/bsg-lib.h
+++ b/include/linux/bsg-lib.h
@@ -65,7 +65,8 @@ struct bsg_job {
 void bsg_job_done(struct bsg_job *job, int result,
 		  unsigned int reply_payload_rcv_len);
 struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
-		bsg_job_fn *job_fn, bsg_timeout_fn *timeout, int dd_job_size);
+		struct queue_limits *lim, bsg_job_fn *job_fn,
+		bsg_timeout_fn *timeout, int dd_job_size);
 void bsg_remove_queue(struct request_queue *q);
 void bsg_job_put(struct bsg_job *job);
 int __must_check bsg_job_get(struct bsg_job *job);
-- 
2.39.2


  parent reply	other threads:[~2024-04-02 13:07 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 13:06 convert SCSI to atomic queue limits, part 1 (v2) Christoph Hellwig
2024-04-02 13:06 ` [PATCH 01/23] block: add a helper to cancel atomic queue limit updates Christoph Hellwig
2024-04-02 23:24   ` Damien Le Moal
2024-04-03  5:04   ` Kanchan Joshi
2024-04-03  6:45   ` Hannes Reinecke
2024-04-03  7:38   ` John Garry
2024-04-03 12:51     ` Christoph Hellwig
2024-04-04  7:14       ` John Garry
2024-04-05  6:34         ` Christoph Hellwig
2024-04-05  6:38           ` Christoph Hellwig
2024-04-04 16:53   ` Bart Van Assche
2024-04-05  6:32     ` Christoph Hellwig
2024-04-02 13:06 ` Christoph Hellwig [this message]
2024-04-03  6:45   ` [PATCH 02/23] bsg: pass queue_limits to bsg_setup_queue Hannes Reinecke
2024-04-02 13:06 ` [PATCH 03/23] mpi3mr: " Christoph Hellwig
2024-04-03  6:46   ` Hannes Reinecke
2024-04-04 16:55   ` Bart Van Assche
2024-04-05  6:42     ` Christoph Hellwig
2024-04-02 13:06 ` [PATCH 04/23] scsi: initialize scsi midlayer limits before allocating the queue Christoph Hellwig
2024-04-03  6:49   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 05/23] scsi_transport_fc: add a max_bsg_segments field to struct fc_function_template Christoph Hellwig
2024-04-03  6:50   ` Hannes Reinecke
2024-04-03 12:53     ` Christoph Hellwig
2024-04-04 16:56   ` Bart Van Assche
2024-04-05  6:43     ` Christoph Hellwig
2024-04-02 13:06 ` [PATCH 06/23] scsi: add a no_highmem flag to struct Scsi_Host Christoph Hellwig
2024-04-03  6:52   ` Hannes Reinecke
2024-04-04 17:01   ` Bart Van Assche
2024-04-02 13:06 ` [PATCH 07/23] scsi: add a dma_alignment field to the host and host template Christoph Hellwig
2024-04-03  6:55   ` Hannes Reinecke
2024-04-04 13:02   ` Greg Kroah-Hartman
2024-04-02 13:06 ` [PATCH 08/23] ufs-exynos: move setting the the dma alignment to the init method Christoph Hellwig
2024-04-03  6:56   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 09/23] scsi: use the atomic queue limits API in scsi_add_lun Christoph Hellwig
2024-04-03  6:57   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 10/23] scsi: add a device_configure method to the host template Christoph Hellwig
2024-04-03  7:00   ` Hannes Reinecke
2024-04-04 17:14   ` Bart Van Assche
2024-04-02 13:06 ` [PATCH 11/23] megaraid_sas: switch to using ->device_configure Christoph Hellwig
2024-04-03  7:06   ` Hannes Reinecke
2024-04-03 12:55     ` Christoph Hellwig
2024-04-02 13:06 ` [PATCH 12/23] mpt3sas: " Christoph Hellwig
2024-04-03  7:08   ` Hannes Reinecke
2024-04-04 17:17     ` Bart Van Assche
2024-04-05  6:44       ` Christoph Hellwig
2024-04-02 13:06 ` [PATCH 13/23] sbp2: " Christoph Hellwig
2024-04-03  7:09   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 14/23] hptiop: " Christoph Hellwig
2024-04-03  7:10   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 15/23] ipr: " Christoph Hellwig
2024-04-03  7:11   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 16/23] pmcraid: " Christoph Hellwig
2024-04-03  7:12   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 17/23] usb-storage: " Christoph Hellwig
2024-04-03  7:13   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 18/23] sata_nv: " Christoph Hellwig
2024-04-03  7:13   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 19/23] pata_macio: " Christoph Hellwig
2024-04-03  7:14   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 20/23] libata: " Christoph Hellwig
2024-04-03  7:15   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 21/23] mpi3mr: " Christoph Hellwig
2024-04-03  7:16   ` Hannes Reinecke
2024-04-02 13:06 ` [PATCH 22/23] uas: switch to using ->device_configure to configure queue limits Christoph Hellwig
2024-04-03  7:17   ` Hannes Reinecke
2024-04-04 13:01   ` Greg Kroah-Hartman
2024-04-02 13:06 ` [PATCH 23/23] block: remove now unused queue limits helpers Christoph Hellwig
2024-04-03  7:18   ` Hannes Reinecke
2024-04-09  2:57 ` convert SCSI to atomic queue limits, part 1 (v2) Martin K. Petersen
2024-05-15 17:22 ` John Garry
2024-05-21 23:13   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2024-04-09 14:37 convert SCSI to atomic queue limits, part 1 (v3) Christoph Hellwig
2024-04-09 14:37 ` [PATCH 02/23] bsg: pass queue_limits to bsg_setup_queue Christoph Hellwig
2024-04-09 15:06   ` Johannes Thumshirn
2024-03-24 23:54 convert SCSI to atomic queue limits, part 1 Christoph Hellwig
2024-03-24 23:54 ` [PATCH 02/23] bsg: pass queue_limits to bsg_setup_queue Christoph Hellwig
2024-03-25  7:16   ` Damien Le Moal
2024-03-25 18:53   ` Bart Van Assche
2024-03-27 14:35   ` John Garry

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=20240402130645.653507-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=GR-QLogic-Storage-Upstream@marvell.com \
    --cc=MPT-FusionLinux.pdl@broadcom.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=brking@us.ibm.com \
    --cc=bvanassche@acm.org \
    --cc=cassel@kernel.org \
    --cc=chandrakanth.patil@broadcom.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=cleech@redhat.com \
    --cc=dlemoal@kernel.org \
    --cc=fischer@norbit.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=john.g.garry@oracle.com \
    --cc=kashyap.desai@broadcom.com \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lduncan@suse.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=linux@highpoint-tech.com \
    --cc=martin.petersen@oracle.com \
    --cc=megaraidlinux.pdl@broadcom.com \
    --cc=michael.christie@oracle.com \
    --cc=mpi3mr-linuxdrv.pdl@broadcom.com \
    --cc=njavali@marvell.com \
    --cc=o-takashi@sakamocchi.jp \
    --cc=sathya.prakash@broadcom.com \
    --cc=shivasharan.srikanteshwara@broadcom.com \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=stern@rowland.harvard.edu \
    --cc=suganath-prabu.subramani@broadcom.com \
    --cc=sumit.saxena@broadcom.com \
    --cc=tyreld@linux.ibm.com \
    --cc=usb-storage@lists.one-eyed-alien.net \
    --cc=yanaijie@huawei.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).