From c8e31f26feeb03dc6f51bff68135cc58431e099b Mon Sep 17 00:00:00 2001 From: Andy Grover Date: Thu, 19 Jan 2012 13:39:17 -0800 Subject: target: Add SCF_SCSI_TMR_CDB usage and drop se_tmr_req_cache Change the test for if a cmd is a tmr request to checking if SCF_SCSI_TMR_CDB (a new flag) is set in cmd->se_cmd_flags. Also remove se_tmr_req_cache usage in favor of kzalloc usage, and make core_tmr_alloc_req() return int + setup se_cmd->se_tmr_req directly and fix up various fabric module usages Cc: Andy Grover Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_tmr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/target/target_core_tmr.c') diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index a5c2e41debf8..5d3eb9e6c2ed 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -40,7 +40,7 @@ #include "target_core_alua.h" #include "target_core_pr.h" -struct se_tmr_req *core_tmr_alloc_req( +int core_tmr_alloc_req( struct se_cmd *se_cmd, void *fabric_tmr_ptr, u8 function, @@ -48,17 +48,20 @@ struct se_tmr_req *core_tmr_alloc_req( { struct se_tmr_req *tmr; - tmr = kmem_cache_zalloc(se_tmr_req_cache, gfp_flags); + tmr = kzalloc(sizeof(struct se_tmr_req), gfp_flags); if (!tmr) { pr_err("Unable to allocate struct se_tmr_req\n"); - return ERR_PTR(-ENOMEM); + return -ENOMEM; } + + se_cmd->se_cmd_flags |= SCF_SCSI_TMR_CDB; + se_cmd->se_tmr_req = tmr; tmr->task_cmd = se_cmd; tmr->fabric_tmr_ptr = fabric_tmr_ptr; tmr->function = function; INIT_LIST_HEAD(&tmr->tmr_list); - return tmr; + return 0; } EXPORT_SYMBOL(core_tmr_alloc_req); @@ -69,7 +72,7 @@ void core_tmr_release_req( unsigned long flags; if (!dev) { - kmem_cache_free(se_tmr_req_cache, tmr); + kfree(tmr); return; } @@ -77,7 +80,7 @@ void core_tmr_release_req( list_del(&tmr->tmr_list); spin_unlock_irqrestore(&dev->se_tmr_lock, flags); - kmem_cache_free(se_tmr_req_cache, tmr); + kfree(tmr); } static void core_tmr_handle_tas_abort( -- cgit v1.2.3