aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/task.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2011-06-17 17:18:39 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:51 -0400
commitdb0562509800a2d4cb5cb14a66413c30484f165c (patch)
treed05cc34b78a8f2a6b9024b8d45e5e8e50786ee64 /drivers/scsi/isci/task.c
parent38d8879baeb61b6946052739e7c03fa79b3a57f0 (diff)
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>
Diffstat (limited to 'drivers/scsi/isci/task.c')
-rw-r--r--drivers/scsi/isci/task.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index d1a46710f4a7..d2dba8354899 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -203,7 +203,7 @@ int isci_task_execute_task(struct sas_task *task, int num, gfp_t gfp_flags)
203 spin_unlock_irqrestore(&task->task_state_lock, flags); 203 spin_unlock_irqrestore(&task->task_state_lock, flags);
204 204
205 /* build and send the request. */ 205 /* build and send the request. */
206 status = isci_request_execute(ihost, idev, task, tag, gfp_flags); 206 status = isci_request_execute(ihost, idev, task, tag);
207 207
208 if (status != SCI_SUCCESS) { 208 if (status != SCI_SUCCESS) {
209 209
@@ -252,7 +252,7 @@ static struct isci_request *isci_task_request_build(struct isci_host *ihost,
252 dev = idev->domain_dev; 252 dev = idev->domain_dev;
253 253
254 /* do common allocation and init of request object. */ 254 /* do common allocation and init of request object. */
255 ireq = isci_request_alloc_tmf(ihost, isci_tmf, GFP_ATOMIC); 255 ireq = isci_tmf_request_from_tag(ihost, isci_tmf, tag);
256 if (!ireq) 256 if (!ireq)
257 return NULL; 257 return NULL;
258 258
@@ -266,7 +266,7 @@ static struct isci_request *isci_task_request_build(struct isci_host *ihost,
266 "status = 0x%x\n", 266 "status = 0x%x\n",
267 __func__, 267 __func__,
268 status); 268 status);
269 goto errout; 269 return NULL;
270 } 270 }
271 271
272 /* XXX convert to get this from task->tproto like other drivers */ 272 /* XXX convert to get this from task->tproto like other drivers */
@@ -274,7 +274,7 @@ static struct isci_request *isci_task_request_build(struct isci_host *ihost,
274 isci_tmf->proto = SAS_PROTOCOL_SSP; 274 isci_tmf->proto = SAS_PROTOCOL_SSP;
275 status = scic_task_request_construct_ssp(&ireq->sci); 275 status = scic_task_request_construct_ssp(&ireq->sci);
276 if (status != SCI_SUCCESS) 276 if (status != SCI_SUCCESS)
277 goto errout; 277 return NULL;
278 } 278 }
279 279
280 if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { 280 if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) {
@@ -282,12 +282,9 @@ static struct isci_request *isci_task_request_build(struct isci_host *ihost,
282 status = isci_sata_management_task_request_build(ireq); 282 status = isci_sata_management_task_request_build(ireq);
283 283
284 if (status != SCI_SUCCESS) 284 if (status != SCI_SUCCESS)
285 goto errout; 285 return NULL;
286 } 286 }
287 return ireq; 287 return ireq;
288 errout:
289 isci_request_free(ihost, ireq);
290 return NULL;
291} 288}
292 289
293int isci_task_execute_tmf(struct isci_host *ihost, 290int isci_task_execute_tmf(struct isci_host *ihost,
@@ -349,7 +346,7 @@ int isci_task_execute_tmf(struct isci_host *ihost,
349 status, 346 status,
350 ireq); 347 ireq);
351 spin_unlock_irqrestore(&ihost->scic_lock, flags); 348 spin_unlock_irqrestore(&ihost->scic_lock, flags);
352 goto err_ireq; 349 goto err_tci;
353 } 350 }
354 351
355 if (tmf->cb_state_func != NULL) 352 if (tmf->cb_state_func != NULL)
@@ -401,8 +398,6 @@ int isci_task_execute_tmf(struct isci_host *ihost,
401 398
402 return ret; 399 return ret;
403 400
404 err_ireq:
405 isci_request_free(ihost, ireq);
406 err_tci: 401 err_tci:
407 spin_lock_irqsave(&ihost->scic_lock, flags); 402 spin_lock_irqsave(&ihost->scic_lock, flags);
408 isci_tci_free(ihost, ISCI_TAG_TCI(tag)); 403 isci_tci_free(ihost, ISCI_TAG_TCI(tag));
@@ -516,8 +511,6 @@ static void isci_request_cleanup_completed_loiterer(
516 spin_lock_irqsave(&isci_host->scic_lock, flags); 511 spin_lock_irqsave(&isci_host->scic_lock, flags);
517 list_del_init(&isci_request->dev_node); 512 list_del_init(&isci_request->dev_node);
518 spin_unlock_irqrestore(&isci_host->scic_lock, flags); 513 spin_unlock_irqrestore(&isci_host->scic_lock, flags);
519
520 isci_request_free(isci_host, isci_request);
521 } 514 }
522} 515}
523 516