Lines Matching refs:task
37 static void sas_end_task(struct scsi_cmnd *sc, struct sas_task *task) in sas_end_task() argument
39 struct task_status_struct *ts = &task->task_status; in sas_end_task()
80 task->dev->port->ha->sas_ha_name); in sas_end_task()
98 sas_free_task(task); in sas_end_task()
101 static void sas_scsi_task_done(struct sas_task *task) in sas_scsi_task_done() argument
103 struct scsi_cmnd *sc = task->uldd_task; in sas_scsi_task_done()
104 struct domain_device *dev = task->dev; in sas_scsi_task_done()
110 task = NULL; in sas_scsi_task_done()
115 if (unlikely(!task)) { in sas_scsi_task_done()
123 sas_free_task(task); in sas_scsi_task_done()
127 sas_end_task(sc, task); in sas_scsi_task_done()
135 struct sas_task *task = sas_alloc_task(gfp_flags); in sas_create_task() local
138 if (!task) in sas_create_task()
141 task->uldd_task = cmd; in sas_create_task()
142 ASSIGN_SAS_TASK(cmd, task); in sas_create_task()
144 task->dev = dev; in sas_create_task()
145 task->task_proto = task->dev->tproto; /* BUG_ON(!SSP) */ in sas_create_task()
147 task->ssp_task.retry_count = 1; in sas_create_task()
149 memcpy(task->ssp_task.LUN, &lun.scsi_lun, 8); in sas_create_task()
150 task->ssp_task.task_attr = TASK_ATTR_SIMPLE; in sas_create_task()
151 task->ssp_task.cmd = cmd; in sas_create_task()
153 task->scatter = scsi_sglist(cmd); in sas_create_task()
154 task->num_scatter = scsi_sg_count(cmd); in sas_create_task()
155 task->total_xfer_len = scsi_bufflen(cmd); in sas_create_task()
156 task->data_dir = cmd->sc_data_direction; in sas_create_task()
158 task->task_done = sas_scsi_task_done; in sas_create_task()
160 return task; in sas_create_task()
167 struct sas_task *task; in sas_queuecommand() local
183 task = sas_create_task(cmd, dev, GFP_ATOMIC); in sas_queuecommand()
184 if (!task) in sas_queuecommand()
187 res = i->dft->lldd_execute_task(task, GFP_ATOMIC); in sas_queuecommand()
195 sas_free_task(task); in sas_queuecommand()
210 struct sas_task *task = TO_SAS_TASK(cmd); in sas_eh_finish_cmd() local
216 sas_end_task(cmd, task); in sas_eh_finish_cmd()
279 static enum task_disposition sas_scsi_find_task(struct sas_task *task) in sas_scsi_find_task() argument
284 to_sas_internal(task->dev->port->ha->core.shost->transportt); in sas_scsi_find_task()
287 pr_notice("%s: aborting task 0x%p\n", __func__, task); in sas_scsi_find_task()
288 res = si->dft->lldd_abort_task(task); in sas_scsi_find_task()
290 spin_lock_irqsave(&task->task_state_lock, flags); in sas_scsi_find_task()
291 if (task->task_state_flags & SAS_TASK_STATE_DONE) { in sas_scsi_find_task()
292 spin_unlock_irqrestore(&task->task_state_lock, flags); in sas_scsi_find_task()
293 pr_debug("%s: task 0x%p is done\n", __func__, task); in sas_scsi_find_task()
296 spin_unlock_irqrestore(&task->task_state_lock, flags); in sas_scsi_find_task()
300 __func__, task); in sas_scsi_find_task()
303 pr_notice("%s: querying task 0x%p\n", __func__, task); in sas_scsi_find_task()
304 res = si->dft->lldd_query_task(task); in sas_scsi_find_task()
308 task); in sas_scsi_find_task()
312 __func__, task); in sas_scsi_find_task()
316 __func__, task); in sas_scsi_find_task()
464 struct sas_task *task = TO_SAS_TASK(cmd); in sas_eh_abort_handler() local
481 if (task) in sas_eh_abort_handler()
482 res = i->dft->lldd_abort_task(task); in sas_eh_abort_handler()
572 struct sas_task *task; in sas_eh_handle_sas_errors() local
579 task = TO_SAS_TASK(cmd); in sas_eh_handle_sas_errors()
582 if (!task) in sas_eh_handle_sas_errors()
588 struct sas_task *task = TO_SAS_TASK(cmd); in sas_eh_handle_sas_errors() local
592 spin_lock_irqsave(&task->task_state_lock, flags); in sas_eh_handle_sas_errors()
593 need_reset = task->task_state_flags & SAS_TASK_NEED_DEV_RESET; in sas_eh_handle_sas_errors()
594 spin_unlock_irqrestore(&task->task_state_lock, flags); in sas_eh_handle_sas_errors()
598 __func__, task); in sas_eh_handle_sas_errors()
602 pr_debug("trying to find task 0x%p\n", task); in sas_eh_handle_sas_errors()
603 res = sas_scsi_find_task(task); in sas_eh_handle_sas_errors()
608 task); in sas_eh_handle_sas_errors()
613 __func__, task); in sas_eh_handle_sas_errors()
617 pr_info("task 0x%p is at LU: lu recover\n", task); in sas_eh_handle_sas_errors()
619 tmf_resp = sas_recover_lu(task->dev, cmd); in sas_eh_handle_sas_errors()
622 SAS_ADDR(task->dev), in sas_eh_handle_sas_errors()
632 task); in sas_eh_handle_sas_errors()
633 tmf_resp = sas_recover_I_T(task->dev); in sas_eh_handle_sas_errors()
636 struct domain_device *dev = task->dev; in sas_eh_handle_sas_errors()
638 SAS_ADDR(task->dev->sas_addr)); in sas_eh_handle_sas_errors()
646 struct asd_sas_port *port = task->dev->port; in sas_eh_handle_sas_errors()
673 SAS_ADDR(task->dev->sas_addr), in sas_eh_handle_sas_errors()
900 void sas_task_abort(struct sas_task *task) in sas_task_abort() argument
902 struct scsi_cmnd *sc = task->uldd_task; in sas_task_abort()
906 struct sas_task_slow *slow = task->slow_task; in sas_task_abort()
916 if (dev_is_sata(task->dev)) in sas_task_abort()
917 sas_ata_task_abort(task); in sas_task_abort()