Skip to content

Commit 4373d2e

Browse files
Christoph Hellwigmartinkpetersen
authored andcommitted
scsi: bsg: Pass queue_limits to bsg_setup_queue()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: John Garry <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 2930662 commit 4373d2e

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

block/bsg-lib.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,14 @@ static const struct blk_mq_ops bsg_mq_ops = {
354354
* bsg_setup_queue - Create and add the bsg hooks so we can receive requests
355355
* @dev: device to attach bsg device to
356356
* @name: device to give bsg device
357+
* @lim: queue limits for the bsg queue
357358
* @job_fn: bsg job handler
358359
* @timeout: timeout handler function pointer
359360
* @dd_job_size: size of LLD data needed for each job
360361
*/
361362
struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
362-
bsg_job_fn *job_fn, bsg_timeout_fn *timeout, int dd_job_size)
363+
struct queue_limits *lim, bsg_job_fn *job_fn,
364+
bsg_timeout_fn *timeout, int dd_job_size)
363365
{
364366
struct bsg_set *bset;
365367
struct blk_mq_tag_set *set;
@@ -383,7 +385,7 @@ struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
383385
if (blk_mq_alloc_tag_set(set))
384386
goto out_tag_set;
385387

386-
q = blk_mq_alloc_queue(set, NULL, NULL);
388+
q = blk_mq_alloc_queue(set, lim, NULL);
387389
if (IS_ERR(q)) {
388390
ret = PTR_ERR(q);
389391
goto out_queue;

drivers/scsi/mpi3mr/mpi3mr_app.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ void mpi3mr_bsg_init(struct mpi3mr_ioc *mrioc)
18601860
return;
18611861
}
18621862

1863-
mrioc->bsg_queue = bsg_setup_queue(bsg_dev, dev_name(bsg_dev),
1863+
mrioc->bsg_queue = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), NULL,
18641864
mpi3mr_bsg_request, NULL, 0);
18651865
if (IS_ERR(mrioc->bsg_queue)) {
18661866
ioc_err(mrioc, "%s: bsg registration failed\n",

drivers/scsi/scsi_transport_fc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4287,8 +4287,8 @@ fc_bsg_hostadd(struct Scsi_Host *shost, struct fc_host_attrs *fc_host)
42874287
snprintf(bsg_name, sizeof(bsg_name),
42884288
"fc_host%d", shost->host_no);
42894289

4290-
q = bsg_setup_queue(dev, bsg_name, fc_bsg_dispatch, fc_bsg_job_timeout,
4291-
i->f->dd_bsg_size);
4290+
q = bsg_setup_queue(dev, bsg_name, NULL, fc_bsg_dispatch,
4291+
fc_bsg_job_timeout, i->f->dd_bsg_size);
42924292
if (IS_ERR(q)) {
42934293
dev_err(dev,
42944294
"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)
43184318
if (!i->f->bsg_request)
43194319
return -ENOTSUPP;
43204320

4321-
q = bsg_setup_queue(dev, dev_name(dev), fc_bsg_dispatch_prep,
4321+
q = bsg_setup_queue(dev, dev_name(dev), NULL, fc_bsg_dispatch_prep,
43224322
fc_bsg_job_timeout, i->f->dd_bsg_size);
43234323
if (IS_ERR(q)) {
43244324
dev_err(dev, "failed to setup bsg queue\n");

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,8 @@ iscsi_bsg_host_add(struct Scsi_Host *shost, struct iscsi_cls_host *ihost)
15421542
return -ENOTSUPP;
15431543

15441544
snprintf(bsg_name, sizeof(bsg_name), "iscsi_host%d", shost->host_no);
1545-
q = bsg_setup_queue(dev, bsg_name, iscsi_bsg_host_dispatch, NULL, 0);
1545+
q = bsg_setup_queue(dev, bsg_name, NULL, iscsi_bsg_host_dispatch, NULL,
1546+
0);
15461547
if (IS_ERR(q)) {
15471548
shost_printk(KERN_ERR, shost, "bsg interface failed to "
15481549
"initialize - no request queue\n");

drivers/scsi/scsi_transport_sas.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
197197
}
198198

199199
if (rphy) {
200-
q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev),
200+
q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev), NULL,
201201
sas_smp_dispatch, NULL, 0);
202202
if (IS_ERR(q))
203203
return PTR_ERR(q);
@@ -206,7 +206,7 @@ static int sas_bsg_initialize(struct Scsi_Host *shost, struct sas_rphy *rphy)
206206
char name[20];
207207

208208
snprintf(name, sizeof(name), "sas_host%d", shost->host_no);
209-
q = bsg_setup_queue(&shost->shost_gendev, name,
209+
q = bsg_setup_queue(&shost->shost_gendev, name, NULL,
210210
sas_smp_dispatch, NULL, 0);
211211
if (IS_ERR(q))
212212
return PTR_ERR(q);

drivers/ufs/core/ufs_bsg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ int ufs_bsg_probe(struct ufs_hba *hba)
253253
if (ret)
254254
goto out;
255255

256-
q = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), ufs_bsg_request, NULL, 0);
256+
q = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), NULL, ufs_bsg_request,
257+
NULL, 0);
257258
if (IS_ERR(q)) {
258259
ret = PTR_ERR(q);
259260
goto out;

include/linux/bsg-lib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ struct bsg_job {
6565
void bsg_job_done(struct bsg_job *job, int result,
6666
unsigned int reply_payload_rcv_len);
6767
struct request_queue *bsg_setup_queue(struct device *dev, const char *name,
68-
bsg_job_fn *job_fn, bsg_timeout_fn *timeout, int dd_job_size);
68+
struct queue_limits *lim, bsg_job_fn *job_fn,
69+
bsg_timeout_fn *timeout, int dd_job_size);
6970
void bsg_remove_queue(struct request_queue *q);
7071
void bsg_job_put(struct bsg_job *job);
7172
int __must_check bsg_job_get(struct bsg_job *job);

0 commit comments

Comments
 (0)