diff options
author | Christoph Hellwig <hch@lst.de> | 2014-09-05 21:23:07 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-24 13:57:03 -0500 |
commit | 82042a2cdb55cd8402207f14a6e2c24d7a5febe8 (patch) | |
tree | 3c1e9660a193d895ddd736775305acc668c8576c /drivers/scsi/scsi.c | |
parent | 3c356bde19e9a728b26a231a23099c8057dbe881 (diff) |
scsi: move scsi_dispatch_cmd to scsi_lib.c
scsi_lib.c is where the rest of the I/O submission path lives, so move
scsi_dispatch_cmd there and mark it static.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r-- | drivers/scsi/scsi.c | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 106fa2f886d2..2d9730432233 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -603,87 +603,6 @@ void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd) | |||
603 | EXPORT_SYMBOL(scsi_cmd_get_serial); | 603 | EXPORT_SYMBOL(scsi_cmd_get_serial); |
604 | 604 | ||
605 | /** | 605 | /** |
606 | * scsi_dispatch_command - Dispatch a command to the low-level driver. | ||
607 | * @cmd: command block we are dispatching. | ||
608 | * | ||
609 | * Return: nonzero return request was rejected and device's queue needs to be | ||
610 | * plugged. | ||
611 | */ | ||
612 | int scsi_dispatch_cmd(struct scsi_cmnd *cmd) | ||
613 | { | ||
614 | struct Scsi_Host *host = cmd->device->host; | ||
615 | int rtn = 0; | ||
616 | |||
617 | atomic_inc(&cmd->device->iorequest_cnt); | ||
618 | |||
619 | /* check if the device is still usable */ | ||
620 | if (unlikely(cmd->device->sdev_state == SDEV_DEL)) { | ||
621 | /* in SDEV_DEL we error all commands. DID_NO_CONNECT | ||
622 | * returns an immediate error upwards, and signals | ||
623 | * that the device is no longer present */ | ||
624 | cmd->result = DID_NO_CONNECT << 16; | ||
625 | goto done; | ||
626 | } | ||
627 | |||
628 | /* Check to see if the scsi lld made this device blocked. */ | ||
629 | if (unlikely(scsi_device_blocked(cmd->device))) { | ||
630 | /* | ||
631 | * in blocked state, the command is just put back on | ||
632 | * the device queue. The suspend state has already | ||
633 | * blocked the queue so future requests should not | ||
634 | * occur until the device transitions out of the | ||
635 | * suspend state. | ||
636 | */ | ||
637 | SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, | ||
638 | "queuecommand : device blocked\n")); | ||
639 | return SCSI_MLQUEUE_DEVICE_BUSY; | ||
640 | } | ||
641 | |||
642 | /* Store the LUN value in cmnd, if needed. */ | ||
643 | if (cmd->device->lun_in_cdb) | ||
644 | cmd->cmnd[1] = (cmd->cmnd[1] & 0x1f) | | ||
645 | (cmd->device->lun << 5 & 0xe0); | ||
646 | |||
647 | scsi_log_send(cmd); | ||
648 | |||
649 | /* | ||
650 | * Before we queue this command, check if the command | ||
651 | * length exceeds what the host adapter can handle. | ||
652 | */ | ||
653 | if (cmd->cmd_len > cmd->device->host->max_cmd_len) { | ||
654 | SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, | ||
655 | "queuecommand : command too long. " | ||
656 | "cdb_size=%d host->max_cmd_len=%d\n", | ||
657 | cmd->cmd_len, cmd->device->host->max_cmd_len)); | ||
658 | cmd->result = (DID_ABORT << 16); | ||
659 | goto done; | ||
660 | } | ||
661 | |||
662 | if (unlikely(host->shost_state == SHOST_DEL)) { | ||
663 | cmd->result = (DID_NO_CONNECT << 16); | ||
664 | goto done; | ||
665 | |||
666 | } | ||
667 | |||
668 | trace_scsi_dispatch_cmd_start(cmd); | ||
669 | rtn = host->hostt->queuecommand(host, cmd); | ||
670 | if (rtn) { | ||
671 | trace_scsi_dispatch_cmd_error(cmd, rtn); | ||
672 | if (rtn != SCSI_MLQUEUE_DEVICE_BUSY && | ||
673 | rtn != SCSI_MLQUEUE_TARGET_BUSY) | ||
674 | rtn = SCSI_MLQUEUE_HOST_BUSY; | ||
675 | |||
676 | SCSI_LOG_MLQUEUE(3, scmd_printk(KERN_INFO, cmd, | ||
677 | "queuecommand : request rejected\n")); | ||
678 | } | ||
679 | |||
680 | return rtn; | ||
681 | done: | ||
682 | cmd->scsi_done(cmd); | ||
683 | return 0; | ||
684 | } | ||
685 | |||
686 | /** | ||
687 | * scsi_finish_command - cleanup and pass command back to upper layer | 606 | * scsi_finish_command - cleanup and pass command back to upper layer |
688 | * @cmd: the command | 607 | * @cmd: the command |
689 | * | 608 | * |