Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302558
b: refs/heads/master
c: 14aaa9f
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Skirvin authored and Dan Williams committed May 17, 2012
1 parent 9b6e56d commit 07a54a7
Show file tree
Hide file tree
Showing 12 changed files with 419 additions and 1,475 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d80ecd5726ce49b5da457d562804b40f0183e8f7
refs/heads/master: 14aaa9f0a318bd04cbb9d822524b817e95d8b343
86 changes: 26 additions & 60 deletions trunk/drivers/scsi/isci/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,102 +1089,63 @@ void isci_host_completion_routine(unsigned long data)
{
struct isci_host *ihost = (struct isci_host *)data;
struct list_head completed_request_list;
struct list_head errored_request_list;
struct list_head *current_position;
struct list_head *next_position;
struct isci_request *request;
struct isci_request *next_request;
struct sas_task *task;
u16 active;

INIT_LIST_HEAD(&completed_request_list);
INIT_LIST_HEAD(&errored_request_list);

spin_lock_irq(&ihost->scic_lock);

sci_controller_completion_handler(ihost);

/* Take the lists of completed I/Os from the host. */

list_splice_init(&ihost->requests_to_complete,
&completed_request_list);

/* Take the list of errored I/Os from the host. */
list_splice_init(&ihost->requests_to_errorback,
&errored_request_list);

spin_unlock_irq(&ihost->scic_lock);

/* Process any completions in the lists. */
/* Process any completions in the list. */
list_for_each_safe(current_position, next_position,
&completed_request_list) {

request = list_entry(current_position, struct isci_request,
completed_node);
task = isci_request_access_task(request);

/* Normal notification (task_done) */
dev_dbg(&ihost->pdev->dev,
"%s: Normal - request/task = %p/%p\n",
__func__,
request,
task);

/* Return the task to libsas */
if (task != NULL) {

task->lldd_task = NULL;
if (!(task->task_state_flags & SAS_TASK_STATE_ABORTED)) {

/* If the task is already in the abort path,
* the task_done callback cannot be called.
*/
task->task_done(task);
if (!test_bit(IREQ_ABORT_PATH_ACTIVE, &request->flags) &&
!(task->task_state_flags & SAS_TASK_STATE_ABORTED)) {
if (test_bit(IREQ_COMPLETE_IN_TARGET,
&request->flags)) {

/* Normal notification (task_done) */
dev_dbg(&ihost->pdev->dev, "%s: Normal"
" - request/task = %p/%p\n",
__func__, request, task);

task->task_done(task);
} else {
dev_warn(&ihost->pdev->dev,
"%s: Error - request/task"
" = %p/%p\n",
__func__, request, task);

sas_task_abort(task);
}
}
}

spin_lock_irq(&ihost->scic_lock);
isci_free_tag(ihost, request->io_tag);
spin_unlock_irq(&ihost->scic_lock);
}
list_for_each_entry_safe(request, next_request, &errored_request_list,
completed_node) {

task = isci_request_access_task(request);

/* Use sas_task_abort */
dev_warn(&ihost->pdev->dev,
"%s: Error - request/task = %p/%p\n",
__func__,
request,
task);

if (task != NULL) {

/* Put the task into the abort path if it's not there
* already.
*/
if (!(task->task_state_flags & SAS_TASK_STATE_ABORTED))
sas_task_abort(task);

} else {
/* This is a case where the request has completed with a
* status such that it needed further target servicing,
* but the sas_task reference has already been removed
* from the request. Since it was errored, it was not
* being aborted, so there is nothing to do except free
* it.
*/

spin_lock_irq(&ihost->scic_lock);
/* Remove the request from the remote device's list
* of pending requests.
*/
list_del_init(&request->dev_node);
isci_free_tag(ihost, request->io_tag);
spin_unlock_irq(&ihost->scic_lock);
}
}

/* the coalesence timeout doubles at each encoding step, so
* update it based on the ilog2 value of the outstanding requests
Expand Down Expand Up @@ -2345,7 +2306,6 @@ static int sci_controller_dma_alloc(struct isci_host *ihost)

ireq->tc = &ihost->task_context_table[i];
ireq->owning_controller = ihost;
spin_lock_init(&ireq->state_lock);
ireq->request_daddr = dma;
ireq->isci_host = ihost;
ihost->reqs[i] = ireq;
Expand Down Expand Up @@ -2697,6 +2657,10 @@ enum sci_status sci_controller_terminate_request(struct isci_host *ihost,
return SCI_FAILURE_INVALID_STATE;
}
status = sci_io_request_terminate(ireq);

dev_dbg(&ihost->pdev->dev, "%s: status=%d; ireq=%p; flags=%lx\n",
__func__, status, ireq, ireq->flags);

if ((status == SCI_SUCCESS) &&
!test_bit(IREQ_PENDING_ABORT, &ireq->flags) &&
!test_and_set_bit(IREQ_TC_ABORT_POSTED, &ireq->flags)) {
Expand Down Expand Up @@ -2739,6 +2703,8 @@ enum sci_status sci_controller_complete_io(struct isci_host *ihost,

index = ISCI_TAG_TCI(ireq->io_tag);
clear_bit(IREQ_ACTIVE, &ireq->flags);
if (test_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags))
wake_up_all(&ihost->eventq);
return SCI_SUCCESS;
default:
dev_warn(&ihost->pdev->dev, "%s invalid state: %d\n",
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/scsi/isci/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ struct isci_host {
wait_queue_head_t eventq;
struct tasklet_struct completion_tasklet;
struct list_head requests_to_complete;
struct list_head requests_to_errorback;
spinlock_t scic_lock;
struct isci_request *reqs[SCI_MAX_IO_REQUESTS];
struct isci_remote_device devices[SCI_MAX_REMOTE_DEVICES];
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/scsi/isci/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,6 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id)
}

INIT_LIST_HEAD(&ihost->requests_to_complete);
INIT_LIST_HEAD(&ihost->requests_to_errorback);
for (i = 0; i < SCI_MAX_PORTS; i++) {
struct isci_port *iport = &ihost->ports[i];

Expand Down
Loading

0 comments on commit 07a54a7

Please sign in to comment.