[SCSI] megaraid: simplify internal command handling
We don't use the passed in scsi command for anything, so just add a adapter- wide internal status to go along with the internal scb that is used unter int_mtx to pass back the return value and get rid of all the complexities and abuse of the scsi_cmnd structure. This gets rid of the only user of scsi_allocate_command/scsi_free_command, which can now be removed. [jejb: checkpatch fixes] Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Adam Radford <aradford@gmail.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
committed by
James Bottomley
parent
c38c007af0
commit
0f2bb84d2a
@@ -402,62 +402,6 @@ static void scsi_put_host_cmd_pool(gfp_t gfp_mask)
|
||||
mutex_unlock(&host_cmd_pool_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
* scsi_allocate_command - get a fully allocated SCSI command
|
||||
* @gfp_mask: allocation mask
|
||||
*
|
||||
* This function is for use outside of the normal host based pools.
|
||||
* It allocates the relevant command and takes an additional reference
|
||||
* on the pool it used. This function *must* be paired with
|
||||
* scsi_free_command which also has the identical mask, otherwise the
|
||||
* free pool counts will eventually go wrong and you'll trigger a bug.
|
||||
*
|
||||
* This function should *only* be used by drivers that need a static
|
||||
* command allocation at start of day for internal functions.
|
||||
*/
|
||||
struct scsi_cmnd *scsi_allocate_command(gfp_t gfp_mask)
|
||||
{
|
||||
struct scsi_host_cmd_pool *pool = scsi_get_host_cmd_pool(gfp_mask);
|
||||
|
||||
if (!pool)
|
||||
return NULL;
|
||||
|
||||
return scsi_pool_alloc_command(pool, gfp_mask);
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_allocate_command);
|
||||
|
||||
/**
|
||||
* scsi_free_command - free a command allocated by scsi_allocate_command
|
||||
* @gfp_mask: mask used in the original allocation
|
||||
* @cmd: command to free
|
||||
*
|
||||
* Note: using the original allocation mask is vital because that's
|
||||
* what determines which command pool we use to free the command. Any
|
||||
* mismatch will cause the system to BUG eventually.
|
||||
*/
|
||||
void scsi_free_command(gfp_t gfp_mask, struct scsi_cmnd *cmd)
|
||||
{
|
||||
struct scsi_host_cmd_pool *pool = scsi_get_host_cmd_pool(gfp_mask);
|
||||
|
||||
/*
|
||||
* this could trigger if the mask to scsi_allocate_command
|
||||
* doesn't match this mask. Otherwise we're guaranteed that this
|
||||
* succeeds because scsi_allocate_command must have taken a reference
|
||||
* on the pool
|
||||
*/
|
||||
BUG_ON(!pool);
|
||||
|
||||
scsi_pool_free_command(pool, cmd);
|
||||
/*
|
||||
* scsi_put_host_cmd_pool is called twice; once to release the
|
||||
* reference we took above, and once to release the reference
|
||||
* originally taken by scsi_allocate_command
|
||||
*/
|
||||
scsi_put_host_cmd_pool(gfp_mask);
|
||||
scsi_put_host_cmd_pool(gfp_mask);
|
||||
}
|
||||
EXPORT_SYMBOL(scsi_free_command);
|
||||
|
||||
/**
|
||||
* scsi_setup_command_freelist - Setup the command freelist for a scsi host.
|
||||
* @shost: host to allocate the freelist for.
|
||||
|
Reference in New Issue
Block a user