···4747 default n4848 depends on NET49495050+config SCSI_MQ_DEFAULT5151+ bool "SCSI: use blk-mq I/O path by default"5252+ depends on SCSI5353+ ---help---5454+ This option enables the new blk-mq based I/O path for SCSI5555+ devices by default. With the option the scsi_mod.use_blk_mq5656+ module/boot option defaults to Y, without it to N, but it can5757+ still be overridden either way.5858+5959+ If unsure say N.6060+5061config SCSI_PROC_FS5162 bool "legacy /proc/scsi/ support"5263 depends on SCSI && PROC_FS
+32-38
drivers/scsi/aacraid/aachba.c
···549549 if ((le32_to_cpu(get_name_reply->status) == CT_OK)550550 && (get_name_reply->data[0] != '\0')) {551551 char *sp = get_name_reply->data;552552- sp[sizeof(((struct aac_get_name_resp *)NULL)->data)] = '\0';552552+ int data_size = FIELD_SIZEOF(struct aac_get_name_resp, data);553553+554554+ sp[data_size - 1] = '\0';553555 while (*sp == ' ')554556 ++sp;555557 if (*sp) {···581579static int aac_get_container_name(struct scsi_cmnd * scsicmd)582580{583581 int status;582582+ int data_size;584583 struct aac_get_name *dinfo;585584 struct fib * cmd_fibcontext;586585 struct aac_dev * dev;587586588587 dev = (struct aac_dev *)scsicmd->device->host->hostdata;589588589589+ data_size = FIELD_SIZEOF(struct aac_get_name_resp, data);590590+590591 cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);591592592593 aac_fib_init(cmd_fibcontext);593594 dinfo = (struct aac_get_name *) fib_data(cmd_fibcontext);595595+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;594596595597 dinfo->command = cpu_to_le32(VM_ContainerConfig);596598 dinfo->type = cpu_to_le32(CT_READ_NAME);597599 dinfo->cid = cpu_to_le32(scmd_id(scsicmd));598598- dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data));600600+ dinfo->count = cpu_to_le32(data_size - 1);599601600602 status = aac_fib_send(ContainerCommand,601603 cmd_fibcontext,···612606 /*613607 * Check that the command queued to the controller614608 */615615- if (status == -EINPROGRESS) {616616- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;609609+ if (status == -EINPROGRESS)617610 return 0;618618- }619611620612 printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status);621613 aac_fib_complete(cmd_fibcontext);···724720725721 dinfo->count = cpu_to_le32(scmd_id(scsicmd));726722 dinfo->type = cpu_to_le32(FT_FILESYS);723723+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;727724728725 status = aac_fib_send(ContainerCommand,729726 fibptr,···736731 /*737732 * Check that the command queued to the controller738733 */739739- if (status == -EINPROGRESS)740740- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;741741- else if (status < 0) {734734+ if (status < 0 && status != -EINPROGRESS) {742735 /* Inherit results from VM_NameServe, if any */743736 dresp->status = cpu_to_le32(ST_OK);744737 _aac_probe_container2(context, fibptr);···764761 dinfo->count = cpu_to_le32(scmd_id(scsicmd));765762 dinfo->type = cpu_to_le32(FT_FILESYS);766763 scsicmd->SCp.ptr = (char *)callback;764764+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;767765768766 status = aac_fib_send(ContainerCommand,769767 fibptr,···776772 /*777773 * Check that the command queued to the controller778774 */779779- if (status == -EINPROGRESS) {780780- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;775775+ if (status == -EINPROGRESS)781776 return 0;782782- }777777+783778 if (status < 0) {784779 scsicmd->SCp.ptr = NULL;785780 aac_fib_complete(fibptr);···11241121 dinfo->command = cpu_to_le32(VM_ContainerConfig);11251122 dinfo->type = cpu_to_le32(CT_CID_TO_32BITS_UID);11261123 dinfo->cid = cpu_to_le32(scmd_id(scsicmd));11241124+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;1127112511281126 status = aac_fib_send(ContainerCommand,11291127 cmd_fibcontext,···11371133 /*11381134 * Check that the command queued to the controller11391135 */11401140- if (status == -EINPROGRESS) {11411141- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;11361136+ if (status == -EINPROGRESS)11421137 return 0;11431143- }1144113811451139 printk(KERN_WARNING "aac_get_container_serial: aac_fib_send failed with status: %d.\n", status);11461140 aac_fib_complete(cmd_fibcontext);···23322330 * Alocate and initialize a Fib23332331 */23342332 cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);23352335-23332333+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;23362334 status = aac_adapter_read(cmd_fibcontext, scsicmd, lba, count);2337233523382336 /*23392337 * Check that the command queued to the controller23402338 */23412341- if (status == -EINPROGRESS) {23422342- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;23392339+ if (status == -EINPROGRESS)23432340 return 0;23442344- }2345234123462342 printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status);23472343 /*···24242424 * Allocate and initialize a Fib then setup a BlockWrite command24252425 */24262426 cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);24272427-24272427+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;24282428 status = aac_adapter_write(cmd_fibcontext, scsicmd, lba, count, fua);2429242924302430 /*24312431 * Check that the command queued to the controller24322432 */24332433- if (status == -EINPROGRESS) {24342434- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;24332433+ if (status == -EINPROGRESS)24352434 return 0;24362436- }2437243524382436 printk(KERN_WARNING "aac_write: aac_fib_send failed with status: %d\n", status);24392437 /*···25812583 synchronizecmd->cid = cpu_to_le32(scmd_id(scsicmd));25822584 synchronizecmd->count =25832585 cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data));25862586+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;2584258725852588 /*25862589 * Now send the Fib to the adapter···25972598 /*25982599 * Check that the command queued to the controller25992600 */26002600- if (status == -EINPROGRESS) {26012601- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;26012601+ if (status == -EINPROGRESS)26022602 return 0;26032603- }2604260326052604 printk(KERN_WARNING26062605 "aac_synchronize: aac_fib_send failed with status: %d.\n", status);···26582661 pmcmd->cid = cpu_to_le32(sdev_id(sdev));26592662 pmcmd->parm = (scsicmd->cmnd[1] & 1) ?26602663 cpu_to_le32(CT_PM_UNIT_IMMEDIATE) : 0;26642664+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;2661266526622666 /*26632667 * Now send the Fib to the adapter···26742676 /*26752677 * Check that the command queued to the controller26762678 */26772677- if (status == -EINPROGRESS) {26782678- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;26792679+ if (status == -EINPROGRESS)26792680 return 0;26802680- }2681268126822682 aac_fib_complete(cmd_fibcontext);26832683 aac_fib_free(cmd_fibcontext);···31943198 return -EBUSY;31953199 if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk)))31963200 return -EFAULT;31973197- if (qd.cnum == -1)32013201+ if (qd.cnum == -1) {32023202+ if (qd.id < 0 || qd.id >= dev->maximum_num_containers)32033203+ return -EINVAL;31983204 qd.cnum = qd.id;31993199- else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1))32003200- {32053205+ } else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) {32013206 if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers)32023207 return -EINVAL;32033208 qd.instance = dev->scsi_host_ptr->host_no;···36833686 * Allocate and initialize a Fib then setup a BlockWrite command36843687 */36853688 cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);36863686-36893689+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;36873690 status = aac_adapter_scsi(cmd_fibcontext, scsicmd);3688369136893692 /*36903693 * Check that the command queued to the controller36913694 */36923692- if (status == -EINPROGRESS) {36933693- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;36953695+ if (status == -EINPROGRESS)36943696 return 0;36953695- }3696369736973698 printk(KERN_WARNING "aac_srb: aac_fib_send failed with status: %d\n", status);36983699 aac_fib_complete(cmd_fibcontext);···37283733 if (!cmd_fibcontext)37293734 return -1;3730373537363736+ scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;37313737 status = aac_adapter_hba(cmd_fibcontext, scsicmd);3732373837333739 /*37343740 * Check that the command queued to the controller37353741 */37363736- if (status == -EINPROGRESS) {37373737- scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;37423742+ if (status == -EINPROGRESS)37383743 return 0;37393739- }3740374437413745 pr_warn("aac_hba_cmd_req: aac_fib_send failed with status: %d\n",37423746 status);
···489489490490 /* If a SRR times out, simply free resources */491491 if (srr_req->event == QEDF_IOREQ_EV_ELS_TMO)492492- goto out_free;492492+ goto out_put;493493494494 /* Normalize response data into struct fc_frame */495495 mp_req = &(srr_req->mp_req);···501501 if (!fp) {502502 QEDF_ERR(&(qedf->dbg_ctx),503503 "fc_frame_alloc failure.\n");504504- goto out_free;504504+ goto out_put;505505 }506506507507 /* Copy frame header from firmware into fp */···526526 }527527528528 fc_frame_free(fp);529529-out_free:529529+out_put:530530 /* Put reference for original command since SRR completed */531531 kref_put(&orig_io_req->refcount, qedf_release_cmd);532532+out_free:532533 kfree(cb_arg);533534}534535···781780782781 /* If a REC times out, free resources */783782 if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO)784784- goto out_free;783783+ goto out_put;785784786785 /* Normalize response data into struct fc_frame */787786 mp_req = &(rec_req->mp_req);···793792 if (!fp) {794793 QEDF_ERR(&(qedf->dbg_ctx),795794 "fc_frame_alloc failure.\n");796796- goto out_free;795795+ goto out_put;797796 }798797799798 /* Copy frame header from firmware into fp */···885884886885out_free_frame:887886 fc_frame_free(fp);888888-out_free:887887+out_put:889888 /* Put reference for original command since REC completed */890889 kref_put(&orig_io_req->refcount, qedf_release_cmd);890890+out_free:891891 kfree(cb_arg);892892}893893
+9-11
drivers/scsi/qedf/qedf_main.c
···27972797 * we allocation is the minimum off:27982798 *27992799 * Number of CPUs28002800- * Number of MSI-X vectors28012801- * Max number allocated in hardware (QEDF_MAX_NUM_CQS)28002800+ * Number allocated by qed for our PCI function28022801 */28032803- qedf->num_queues = min((unsigned int)QEDF_MAX_NUM_CQS,28042804- num_online_cpus());28022802+ qedf->num_queues = MIN_NUM_CPUS_MSIX(qedf);2805280328062804 QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Number of CQs is %d.\n",28072805 qedf->num_queues);···29972999 goto err1;29983000 }2999300130023002+ /* Learn information crucial for qedf to progress */30033003+ rc = qed_ops->fill_dev_info(qedf->cdev, &qedf->dev_info);30043004+ if (rc) {30053005+ QEDF_ERR(&(qedf->dbg_ctx), "Failed to dev info.\n");30063006+ goto err1;30073007+ }30083008+30003009 /* queue allocation code should come here30013010 * order should be30023011 * slowpath_start···30183013 goto err2;30193014 }30203015 qed_ops->common->update_pf_params(qedf->cdev, &qedf->pf_params);30213021-30223022- /* Learn information crucial for qedf to progress */30233023- rc = qed_ops->fill_dev_info(qedf->cdev, &qedf->dev_info);30243024- if (rc) {30253025- QEDF_ERR(&(qedf->dbg_ctx), "Failed to dev info.\n");30263026- goto err1;30273027- }3028301630293017 /* Record BDQ producer doorbell addresses */30303018 qedf->bdq_primary_prod = qedf->dev_info.primary_dbq_rq_addr;
···401401 for (i = 0; i < vha->hw->max_req_queues; i++) {402402 struct req_que *req = vha->hw->req_q_map[i];403403404404- if (!test_bit(i, vha->hw->req_qid_map))405405- continue;406406-407404 if (req || !buf) {408405 length = req ?409406 req->length : REQUEST_ENTRY_CNT_24XX;···414417 } else if (ent->t263.queue_type == T263_QUEUE_TYPE_RSP) {415418 for (i = 0; i < vha->hw->max_rsp_queues; i++) {416419 struct rsp_que *rsp = vha->hw->rsp_q_map[i];417417-418418- if (!test_bit(i, vha->hw->rsp_qid_map))419419- continue;420420421421 if (rsp || !buf) {422422 length = rsp ?···658664 for (i = 0; i < vha->hw->max_req_queues; i++) {659665 struct req_que *req = vha->hw->req_q_map[i];660666661661- if (!test_bit(i, vha->hw->req_qid_map))662662- continue;663663-664667 if (req || !buf) {665668 qla27xx_insert16(i, buf, len);666669 qla27xx_insert16(1, buf, len);···669678 } else if (ent->t274.queue_type == T274_QUEUE_TYPE_RSP_SHAD) {670679 for (i = 0; i < vha->hw->max_rsp_queues; i++) {671680 struct rsp_que *rsp = vha->hw->rsp_q_map[i];672672-673673- if (!test_bit(i, vha->hw->rsp_qid_map))674674- continue;675681676682 if (rsp || !buf) {677683 qla27xx_insert16(i, buf, len);
+4
drivers/scsi/scsi.c
···780780module_param(scsi_logging_level, int, S_IRUGO|S_IWUSR);781781MODULE_PARM_DESC(scsi_logging_level, "a bit mask of logging levels");782782783783+#ifdef CONFIG_SCSI_MQ_DEFAULT783784bool scsi_use_blk_mq = true;785785+#else786786+bool scsi_use_blk_mq = false;787787+#endif784788module_param_named(use_blk_mq, scsi_use_blk_mq, bool, S_IWUSR | S_IRUGO);785789786790static int __init init_scsi(void)
+3
drivers/scsi/sd.c
···12771277{12781278 struct request *rq = SCpnt->request;1279127912801280+ if (SCpnt->flags & SCMD_ZONE_WRITE_LOCK)12811281+ sd_zbc_write_unlock_zone(SCpnt);12821282+12801283 if (rq->rq_flags & RQF_SPECIAL_PAYLOAD)12811284 __free_page(rq->special_vec.bv_page);12821285
+5-4
drivers/scsi/sd_zbc.c
···294294 test_and_set_bit(zno, sdkp->zones_wlock))295295 return BLKPREP_DEFER;296296297297+ WARN_ON_ONCE(cmd->flags & SCMD_ZONE_WRITE_LOCK);298298+ cmd->flags |= SCMD_ZONE_WRITE_LOCK;299299+297300 return BLKPREP_OK;298301}299302···305302 struct request *rq = cmd->request;306303 struct scsi_disk *sdkp = scsi_disk(rq->rq_disk);307304308308- if (sdkp->zones_wlock) {305305+ if (sdkp->zones_wlock && cmd->flags & SCMD_ZONE_WRITE_LOCK) {309306 unsigned int zno = sd_zbc_zone_no(sdkp, blk_rq_pos(rq));310307 WARN_ON_ONCE(!test_bit(zno, sdkp->zones_wlock));308308+ cmd->flags &= ~SCMD_ZONE_WRITE_LOCK;311309 clear_bit_unlock(zno, sdkp->zones_wlock);312310 smp_mb__after_atomic();313311 }···338334 case REQ_OP_WRITE:339335 case REQ_OP_WRITE_ZEROES:340336 case REQ_OP_WRITE_SAME:341341-342342- /* Unlock the zone */343343- sd_zbc_write_unlock_zone(cmd);344337345338 if (result &&346339 sshdr->sense_key == ILLEGAL_REQUEST &&
+1-1
drivers/scsi/ses.c
···106106107107 ret = scsi_execute_req(sdev, cmd, DMA_FROM_DEVICE, buf, bufflen,108108 NULL, SES_TIMEOUT, SES_RETRIES, NULL);109109- if (unlikely(!ret))109109+ if (unlikely(ret))110110 return ret;111111112112 recv_page_code = ((unsigned char *)buf)[0];
+2-31
drivers/scsi/sg.c
···751751 return count;752752}753753754754-static bool sg_is_valid_dxfer(sg_io_hdr_t *hp)755755-{756756- switch (hp->dxfer_direction) {757757- case SG_DXFER_NONE:758758- if (hp->dxferp || hp->dxfer_len > 0)759759- return false;760760- return true;761761- case SG_DXFER_FROM_DEV:762762- /*763763- * for SG_DXFER_FROM_DEV we always set dxfer_len to > 0. dxferp764764- * can either be NULL or != NULL so there's no point in checking765765- * it either. So just return true.766766- */767767- return true;768768- case SG_DXFER_TO_DEV:769769- case SG_DXFER_TO_FROM_DEV:770770- if (!hp->dxferp || hp->dxfer_len == 0)771771- return false;772772- return true;773773- case SG_DXFER_UNKNOWN:774774- if ((!hp->dxferp && hp->dxfer_len) ||775775- (hp->dxferp && hp->dxfer_len == 0))776776- return false;777777- return true;778778- default:779779- return false;780780- }781781-}782782-783754static int784755sg_common_write(Sg_fd * sfp, Sg_request * srp,785756 unsigned char *cmnd, int timeout, int blocking)···771800 "sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n",772801 (int) cmnd[0], (int) hp->cmd_len));773802774774- if (!sg_is_valid_dxfer(hp))803803+ if (hp->dxfer_len >= SZ_256M)775804 return -EINVAL;776805777806 k = sg_start_req(srp, cmnd);···10211050 read_lock_irqsave(&sfp->rq_list_lock, iflags);10221051 val = 0;10231052 list_for_each_entry(srp, &sfp->rq_list, entry) {10241024- if (val > SG_MAX_QUEUE)10531053+ if (val >= SG_MAX_QUEUE)10251054 break;10261055 memset(&rinfo[val], 0, SZ_SG_REQ_INFO);10271056 rinfo[val].req_state = srp->done + 1;
+2-2
drivers/scsi/st.c
···42994299 kref_init(&tpnt->kref);43004300 tpnt->disk = disk;43014301 disk->private_data = &tpnt->driver;43024302- disk->queue = SDp->request_queue;43034302 /* SCSI tape doesn't register this gendisk via add_disk(). Manually43044303 * take queue reference that release_disk() expects. */43054305- if (!blk_get_queue(disk->queue))43044304+ if (!blk_get_queue(SDp->request_queue))43064305 goto out_put_disk;43064306+ disk->queue = SDp->request_queue;43074307 tpnt->driver = &st_template;4308430843094309 tpnt->device = SDp;