aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r--drivers/scsi/scsi.c56
1 files changed, 0 insertions, 56 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 1d98ac960887..c4dd0bfc663a 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -403,62 +403,6 @@ static void scsi_put_host_cmd_pool(gfp_t gfp_mask)
403} 403}
404 404
405/** 405/**
406 * scsi_allocate_command - get a fully allocated SCSI command
407 * @gfp_mask: allocation mask
408 *
409 * This function is for use outside of the normal host based pools.
410 * It allocates the relevant command and takes an additional reference
411 * on the pool it used. This function *must* be paired with
412 * scsi_free_command which also has the identical mask, otherwise the
413 * free pool counts will eventually go wrong and you'll trigger a bug.
414 *
415 * This function should *only* be used by drivers that need a static
416 * command allocation at start of day for internal functions.
417 */
418struct scsi_cmnd *scsi_allocate_command(gfp_t gfp_mask)
419{
420 struct scsi_host_cmd_pool *pool = scsi_get_host_cmd_pool(gfp_mask);
421
422 if (!pool)
423 return NULL;
424
425 return scsi_pool_alloc_command(pool, gfp_mask);
426}
427EXPORT_SYMBOL(scsi_allocate_command);
428
429/**
430 * scsi_free_command - free a command allocated by scsi_allocate_command
431 * @gfp_mask: mask used in the original allocation
432 * @cmd: command to free
433 *
434 * Note: using the original allocation mask is vital because that's
435 * what determines which command pool we use to free the command. Any
436 * mismatch will cause the system to BUG eventually.
437 */
438void scsi_free_command(gfp_t gfp_mask, struct scsi_cmnd *cmd)
439{
440 struct scsi_host_cmd_pool *pool = scsi_get_host_cmd_pool(gfp_mask);
441
442 /*
443 * this could trigger if the mask to scsi_allocate_command
444 * doesn't match this mask. Otherwise we're guaranteed that this
445 * succeeds because scsi_allocate_command must have taken a reference
446 * on the pool
447 */
448 BUG_ON(!pool);
449
450 scsi_pool_free_command(pool, cmd);
451 /*
452 * scsi_put_host_cmd_pool is called twice; once to release the
453 * reference we took above, and once to release the reference
454 * originally taken by scsi_allocate_command
455 */
456 scsi_put_host_cmd_pool(gfp_mask);
457 scsi_put_host_cmd_pool(gfp_mask);
458}
459EXPORT_SYMBOL(scsi_free_command);
460
461/**
462 * scsi_setup_command_freelist - Setup the command freelist for a scsi host. 406 * scsi_setup_command_freelist - Setup the command freelist for a scsi host.
463 * @shost: host to allocate the freelist for. 407 * @shost: host to allocate the freelist for.
464 * 408 *