From 226b6faf2e30e272ee5a52c2ed0a8c8a1d7b47d1 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 24 Apr 2012 00:25:07 -0400 Subject: [PATCH] target: remove the t_task_cdbs_left field in struct se_cmd Now that tasks are gone we are guaranteed to only get a single completion per command, and thus don't need this counter. Signed-off-by: Christoph Hellwig Signed-off-by: Nicholas Bellinger --- drivers/target/target_core_tmr.c | 2 -- drivers/target/target_core_transport.c | 11 +---------- include/target/target_core_base.h | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 6e2378a..bd0b4e6 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -313,11 +313,9 @@ static void core_tmr_drain_state_list( cmd->se_tfo->get_cmd_state(cmd), cmd->t_state, cmd->t_task_cdb[0]); pr_debug("LUN_RESET: ITT[0x%08x] - pr_res_key: 0x%016Lx" - " t_task_cdbs_left: %d" " -- CMD_T_ACTIVE: %d" " CMD_T_STOP: %d CMD_T_SENT: %d\n", cmd->se_tfo->get_task_tag(cmd), cmd->pr_res_key, - atomic_read(&cmd->t_task_cdbs_left), (cmd->transport_state & CMD_T_ACTIVE) != 0, (cmd->transport_state & CMD_T_STOP) != 0, (cmd->transport_state & CMD_T_SENT) != 0); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 47669c6..28df7b8 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -700,11 +700,6 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status) if (!success) cmd->transport_state |= CMD_T_FAILED; - if (!atomic_dec_and_test(&cmd->t_task_cdbs_left)) { - spin_unlock_irqrestore(&cmd->t_state_lock, flags); - return; - } - /* * Check for case where an explict ABORT_TASK has been received * and transport_wait_for_tasks() will be waiting for completion.. @@ -1755,7 +1750,6 @@ bool target_stop_cmd(struct se_cmd *cmd, unsigned long *flags) pr_debug("cmd %p stopped successfully\n", cmd); spin_lock_irqsave(&cmd->t_state_lock, *flags); - atomic_dec(&cmd->t_task_cdbs_left); cmd->transport_state &= ~CMD_T_REQUEST_STOP; cmd->transport_state &= ~CMD_T_BUSY; was_active = true; @@ -1777,10 +1771,8 @@ void transport_generic_request_failure(struct se_cmd *cmd) pr_debug("-----[ i_state: %d t_state: %d scsi_sense_reason: %d\n", cmd->se_tfo->get_cmd_state(cmd), cmd->t_state, cmd->scsi_sense_reason); - pr_debug("-----[ t_task_cdbs_left: %d" - " t_task_cdbs_ex_left: %d --" + pr_debug("-----[ t_task_cdbs_ex_left: %d --" " CMD_T_ACTIVE: %d CMD_T_STOP: %d CMD_T_SENT: %d\n", - atomic_read(&cmd->t_task_cdbs_left), atomic_read(&cmd->t_task_cdbs_ex_left), (cmd->transport_state & CMD_T_ACTIVE) != 0, (cmd->transport_state & CMD_T_STOP) != 0, @@ -3511,7 +3503,6 @@ int transport_generic_new_cmd(struct se_cmd *cmd) atomic_inc(&cmd->t_fe_count); atomic_inc(&cmd->t_se_count); - atomic_set(&cmd->t_task_cdbs_left, 1); atomic_set(&cmd->t_task_cdbs_ex_left, 1); /* diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 55a80bd..f176b82 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -549,7 +549,6 @@ struct se_cmd { unsigned long long t_task_lba; atomic_t t_fe_count; atomic_t t_se_count; - atomic_t t_task_cdbs_left; atomic_t t_task_cdbs_ex_left; unsigned int transport_state; #define CMD_T_ABORTED (1 << 0) -- 2.7.4