drivers/scsi/isci/task.c
Source file repositories/reference/linux-study-clean/drivers/scsi/isci/task.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/isci/task.c- Extension
.c- Size
- 23682 bytes
- Lines
- 780
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/completion.hlinux/irqflags.hsas.hscsi/libsas.hremote_device.hremote_node_context.hisci.hrequest.htask.hhost.h
Detected Declarations
function isci_task_refusefunction isci_device_io_readyfunction isci_task_execute_taskfunction isci_task_execute_tmffunction isci_task_build_tmffunction isci_task_build_abort_task_tmffunction isci_task_send_lu_reset_sasfunction isci_task_lu_resetfunction isci_task_clear_nexus_portfunction isci_task_clear_nexus_hafunction isci_task_abort_taskfunction isci_task_abort_task_setfunction isci_task_clear_task_setfunction isci_task_query_taskfunction isci_task_request_completefunction isci_reset_devicefunction removedfunction isci_task_I_T_nexus_reset
Annotated Snippet
if (task->task_state_flags & SAS_TASK_STATE_ABORTED) {
/* The I/O was aborted. */
spin_unlock_irqrestore(&task->task_state_lock, flags);
isci_task_refuse(ihost, task,
SAS_TASK_UNDELIVERED,
SAS_SAM_STAT_TASK_ABORTED);
} else {
struct isci_request *ireq;
/* do common allocation and init of request object. */
ireq = isci_io_request_from_tag(ihost, task, tag);
spin_unlock_irqrestore(&task->task_state_lock, flags);
/* build and send the request. */
/* do common allocation and init of request object. */
status = isci_request_execute(ihost, idev, task, ireq);
if (status != SCI_SUCCESS) {
if (test_bit(IDEV_GONE, &idev->flags)) {
/* Indicate that the device
* is gone.
*/
isci_task_refuse(ihost, task,
SAS_TASK_UNDELIVERED,
SAS_DEVICE_UNKNOWN);
} else {
/* Indicate QUEUE_FULL so that
* the scsi midlayer retries.
* If the request failed for
* remote device reasons, it
* gets returned as
* SAS_TASK_UNDELIVERED next
* time through.
*/
isci_task_refuse(ihost, task,
SAS_TASK_COMPLETE,
SAS_QUEUE_FULL);
}
}
}
}
if (status != SCI_SUCCESS && tag != SCI_CONTROLLER_INVALID_IO_TAG) {
spin_lock_irqsave(&ihost->scic_lock, flags);
/* command never hit the device, so just free
* the tci and skip the sequence increment
*/
isci_tci_free(ihost, ISCI_TAG_TCI(tag));
spin_unlock_irqrestore(&ihost->scic_lock, flags);
}
isci_put_device(idev);
return 0;
}
static struct isci_request *isci_task_request_build(struct isci_host *ihost,
struct isci_remote_device *idev,
u16 tag, struct isci_tmf *isci_tmf)
{
enum sci_status status = SCI_FAILURE;
struct isci_request *ireq = NULL;
struct domain_device *dev;
dev_dbg(&ihost->pdev->dev,
"%s: isci_tmf = %p\n", __func__, isci_tmf);
dev = idev->domain_dev;
/* do common allocation and init of request object. */
ireq = isci_tmf_request_from_tag(ihost, isci_tmf, tag);
if (!ireq)
return NULL;
/* let the core do it's construct. */
status = sci_task_request_construct(ihost, idev, tag,
ireq);
if (status != SCI_SUCCESS) {
dev_warn(&ihost->pdev->dev,
"%s: sci_task_request_construct failed - "
"status = 0x%x\n",
__func__,
status);
return NULL;
}
/* XXX convert to get this from task->tproto like other drivers */
if (dev->dev_type == SAS_END_DEVICE) {
isci_tmf->proto = SAS_PROTOCOL_SSP;
Annotation
- Immediate include surface: `linux/completion.h`, `linux/irqflags.h`, `sas.h`, `scsi/libsas.h`, `remote_device.h`, `remote_node_context.h`, `isci.h`, `request.h`.
- Detected declarations: `function isci_task_refuse`, `function isci_device_io_ready`, `function isci_task_execute_task`, `function isci_task_execute_tmf`, `function isci_task_build_tmf`, `function isci_task_build_abort_task_tmf`, `function isci_task_send_lu_reset_sas`, `function isci_task_lu_reset`, `function isci_task_clear_nexus_port`, `function isci_task_clear_nexus_ha`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.