Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <hch@lst.de>
Link: https://lore.kernel.org/r/20240409143748.980206-3-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>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Christoph Hellwig and committed by
Martin K. Petersen
4373d2ec 29306626

+16 -11
+4 -2
block/bsg-lib.c
··· 354 354 * bsg_setup_queue - Create and add the bsg hooks so we can receive requests 355 355 * @dev: device to attach bsg device to 356 356 * @name: device to give bsg device 357 + * @lim: queue limits for the bsg queue 357 358 * @job_fn: bsg job handler 358 359 * @timeout: timeout handler function pointer 359 360 * @dd_job_size: size of LLD data needed for each job 360 361 */ 361 362 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) 363 365 { 364 366 struct bsg_set *bset; 365 367 struct blk_mq_tag_set *set; ··· 385 383 if (blk_mq_alloc_tag_set(set)) 386 384 goto out_tag_set; 387 385 388 - q = blk_mq_alloc_queue(set, NULL, NULL); 386 + q = blk_mq_alloc_queue(set, lim, NULL); 389 387 if (IS_ERR(q)) { 390 388 ret = PTR_ERR(q); 391 389 goto out_queue;
+1 -1
drivers/scsi/mpi3mr/mpi3mr_app.c
··· 1860 1860 return; 1861 1861 } 1862 1862 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, 1864 1864 mpi3mr_bsg_request, NULL, 0); 1865 1865 if (IS_ERR(mrioc->bsg_queue)) { 1866 1866 ioc_err(mrioc, "%s: bsg registration failed\n",
+3 -3
drivers/scsi/scsi_transport_fc.c
··· 4287 4287 snprintf(bsg_name, sizeof(bsg_name), 4288 4288 "fc_host%d", shost->host_no); 4289 4289 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); 4292 4292 if (IS_ERR(q)) { 4293 4293 dev_err(dev, 4294 4294 "fc_host%d: bsg interface failed to initialize - setup queue\n", ··· 4318 4318 if (!i->f->bsg_request) 4319 4319 return -ENOTSUPP; 4320 4320 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, 4322 4322 fc_bsg_job_timeout, i->f->dd_bsg_size); 4323 4323 if (IS_ERR(q)) { 4324 4324 dev_err(dev, "failed to setup bsg queue\n");
+2 -1
drivers/scsi/scsi_transport_iscsi.c
··· 1542 1542 return -ENOTSUPP; 1543 1543 1544 1544 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); 1546 1547 if (IS_ERR(q)) { 1547 1548 shost_printk(KERN_ERR, shost, "bsg interface failed to " 1548 1549 "initialize - no request queue\n");
+2 -2
drivers/scsi/scsi_transport_sas.c
··· 197 197 } 198 198 199 199 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, 201 201 sas_smp_dispatch, NULL, 0); 202 202 if (IS_ERR(q)) 203 203 return PTR_ERR(q); ··· 206 206 char name[20]; 207 207 208 208 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, 210 210 sas_smp_dispatch, NULL, 0); 211 211 if (IS_ERR(q)) 212 212 return PTR_ERR(q);
+2 -1
drivers/ufs/core/ufs_bsg.c
··· 253 253 if (ret) 254 254 goto out; 255 255 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); 257 258 if (IS_ERR(q)) { 258 259 ret = PTR_ERR(q); 259 260 goto out;
+2 -1
include/linux/bsg-lib.h
··· 65 65 void bsg_job_done(struct bsg_job *job, int result, 66 66 unsigned int reply_payload_rcv_len); 67 67 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); 69 70 void bsg_remove_queue(struct request_queue *q); 70 71 void bsg_job_put(struct bsg_job *job); 71 72 int __must_check bsg_job_get(struct bsg_job *job);