isci: preallocate requests

the dma_pool interface is optimized for object_size << page_size which
is not the case with isci_request objects and the dma_pool routines show
up in the top of the profile.

The old io_request_table which tracked whether tci slots were in-flight
or not is replaced with an IREQ_ACTIVE flag per request.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index d1a4671..d2dba83 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -203,7 +203,7 @@
 				spin_unlock_irqrestore(&task->task_state_lock, flags);
 
 				/* build and send the request. */
-				status = isci_request_execute(ihost, idev, task, tag, gfp_flags);
+				status = isci_request_execute(ihost, idev, task, tag);
 
 				if (status != SCI_SUCCESS) {
 
@@ -252,7 +252,7 @@
 	dev = idev->domain_dev;
 
 	/* do common allocation and init of request object. */
-	ireq = isci_request_alloc_tmf(ihost, isci_tmf, GFP_ATOMIC);
+	ireq = isci_tmf_request_from_tag(ihost, isci_tmf, tag);
 	if (!ireq)
 		return NULL;
 
@@ -266,7 +266,7 @@
 			 "status = 0x%x\n",
 			 __func__,
 			 status);
-		goto errout;
+		return NULL;
 	}
 
 	/* XXX convert to get this from task->tproto like other drivers */
@@ -274,7 +274,7 @@
 		isci_tmf->proto = SAS_PROTOCOL_SSP;
 		status = scic_task_request_construct_ssp(&ireq->sci);
 		if (status != SCI_SUCCESS)
-			goto errout;
+			return NULL;
 	}
 
 	if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
@@ -282,12 +282,9 @@
 		status = isci_sata_management_task_request_build(ireq);
 
 		if (status != SCI_SUCCESS)
-			goto errout;
+			return NULL;
 	}
 	return ireq;
- errout:
-	isci_request_free(ihost, ireq);
-	return NULL;
 }
 
 int isci_task_execute_tmf(struct isci_host *ihost,
@@ -349,7 +346,7 @@
 			 status,
 			 ireq);
 		spin_unlock_irqrestore(&ihost->scic_lock, flags);
-		goto err_ireq;
+		goto err_tci;
 	}
 
 	if (tmf->cb_state_func != NULL)
@@ -401,8 +398,6 @@
 
 	return ret;
 
- err_ireq:
-	isci_request_free(ihost, ireq);
  err_tci:
 	spin_lock_irqsave(&ihost->scic_lock, flags);
 	isci_tci_free(ihost, ISCI_TAG_TCI(tag));
@@ -516,8 +511,6 @@
 		spin_lock_irqsave(&isci_host->scic_lock, flags);
 		list_del_init(&isci_request->dev_node);
 		spin_unlock_irqrestore(&isci_host->scic_lock, flags);
-
-		isci_request_free(isci_host, isci_request);
 	}
 }