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

bsg: pass in desired timeout handler

This will ease in the conversion to blk-mq, where we can't set
a timeout handler after queue init.

Cc: Johannes Thumshirn <jthumshirn@suse.de>
Cc: linux-scsi@vger.kernel.org
Reviewed-by: Hannes Reinecke <hare@suse.com>
Tested-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Tested-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

+10 -10
+2 -1
block/bsg-lib.c
··· 304 304 * @dd_job_size: size of LLD data needed for each job 305 305 */ 306 306 struct request_queue *bsg_setup_queue(struct device *dev, const char *name, 307 - bsg_job_fn *job_fn, int dd_job_size) 307 + bsg_job_fn *job_fn, rq_timed_out_fn *timeout, int dd_job_size) 308 308 { 309 309 struct request_queue *q; 310 310 int ret; ··· 327 327 blk_queue_flag_set(QUEUE_FLAG_BIDI, q); 328 328 blk_queue_softirq_done(q, bsg_softirq_done); 329 329 blk_queue_rq_timeout(q, BLK_DEFAULT_SG_TIMEOUT); 330 + blk_queue_rq_timed_out(q, timeout); 330 331 331 332 ret = bsg_register_queue(q, dev, name, &bsg_transport_ops); 332 333 if (ret) {
+3 -4
drivers/scsi/scsi_transport_fc.c
··· 3780 3780 snprintf(bsg_name, sizeof(bsg_name), 3781 3781 "fc_host%d", shost->host_no); 3782 3782 3783 - q = bsg_setup_queue(dev, bsg_name, fc_bsg_dispatch, i->f->dd_bsg_size); 3783 + q = bsg_setup_queue(dev, bsg_name, fc_bsg_dispatch, fc_bsg_job_timeout, 3784 + i->f->dd_bsg_size); 3784 3785 if (IS_ERR(q)) { 3785 3786 dev_err(dev, 3786 3787 "fc_host%d: bsg interface failed to initialize - setup queue\n", ··· 3789 3788 return PTR_ERR(q); 3790 3789 } 3791 3790 __scsi_init_queue(shost, q); 3792 - blk_queue_rq_timed_out(q, fc_bsg_job_timeout); 3793 3791 blk_queue_rq_timeout(q, FC_DEFAULT_BSG_TIMEOUT); 3794 3792 fc_host->rqst_q = q; 3795 3793 return 0; ··· 3826 3826 return -ENOTSUPP; 3827 3827 3828 3828 q = bsg_setup_queue(dev, dev_name(dev), fc_bsg_dispatch, 3829 - i->f->dd_bsg_size); 3829 + fc_bsg_job_timeout, i->f->dd_bsg_size); 3830 3830 if (IS_ERR(q)) { 3831 3831 dev_err(dev, "failed to setup bsg queue\n"); 3832 3832 return PTR_ERR(q); 3833 3833 } 3834 3834 __scsi_init_queue(shost, q); 3835 3835 blk_queue_prep_rq(q, fc_bsg_rport_prep); 3836 - blk_queue_rq_timed_out(q, fc_bsg_job_timeout); 3837 3836 blk_queue_rq_timeout(q, BLK_DEFAULT_SG_TIMEOUT); 3838 3837 rport->rqst_q = q; 3839 3838 return 0;
+1 -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, 0); 1545 + q = bsg_setup_queue(dev, bsg_name, iscsi_bsg_host_dispatch, NULL, 0); 1546 1546 if (IS_ERR(q)) { 1547 1547 shost_printk(KERN_ERR, shost, "bsg interface failed to " 1548 1548 "initialize - no request queue\n");
+2 -2
drivers/scsi/scsi_transport_sas.c
··· 198 198 199 199 if (rphy) { 200 200 q = bsg_setup_queue(&rphy->dev, dev_name(&rphy->dev), 201 - sas_smp_dispatch, 0); 201 + sas_smp_dispatch, NULL, 0); 202 202 if (IS_ERR(q)) 203 203 return PTR_ERR(q); 204 204 rphy->q = q; ··· 207 207 208 208 snprintf(name, sizeof(name), "sas_host%d", shost->host_no); 209 209 q = bsg_setup_queue(&shost->shost_gendev, name, 210 - sas_smp_dispatch, 0); 210 + sas_smp_dispatch, NULL, 0); 211 211 if (IS_ERR(q)) 212 212 return PTR_ERR(q); 213 213 to_sas_host_attrs(shost)->q = q;
+1 -1
drivers/scsi/ufs/ufs_bsg.c
··· 193 193 if (ret) 194 194 goto out; 195 195 196 - q = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), ufs_bsg_request, 0); 196 + q = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), ufs_bsg_request, NULL, 0); 197 197 if (IS_ERR(q)) { 198 198 ret = PTR_ERR(q); 199 199 goto out;
+1 -1
include/linux/bsg-lib.h
··· 72 72 void bsg_job_done(struct bsg_job *job, int result, 73 73 unsigned int reply_payload_rcv_len); 74 74 struct request_queue *bsg_setup_queue(struct device *dev, const char *name, 75 - bsg_job_fn *job_fn, int dd_job_size); 75 + bsg_job_fn *job_fn, rq_timed_out_fn *timeout, int dd_job_size); 76 76 void bsg_job_put(struct bsg_job *job); 77 77 int __must_check bsg_job_get(struct bsg_job *job); 78 78