diff options
author | Christoph Hellwig <hch@infradead.org> | 2011-12-21 14:13:47 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-02-25 14:37:45 -0800 |
commit | 7d680f3b74dd6f0f57569eeeee8c257790ceaa96 (patch) | |
tree | e0797ab722c222213b7cbe4fa9ba4a61db2d8b0c /drivers/target/target_core_tmr.c | |
parent | b01543dfe67bb1d191998e90d20534dc354de059 (diff) | |
download | lwn-7d680f3b74dd6f0f57569eeeee8c257790ceaa96.tar.gz lwn-7d680f3b74dd6f0f57569eeeee8c257790ceaa96.zip |
target: replace various cmd flags with a transport state
Replace various atomic_ts used as flags in struct se_cmd with a single
transport_state bitmap that requires t_state_lock to be held for modifications.
In the target core that assumption generally is true, but some recently added
code in the SRP target had to grow new lock calls. I can't say I like the way
how it messes with the command state directly, but let's leave that for later.
(Re-add missing ib_srpt.c changes that nab dropped..)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_tmr.c')
-rw-r--r-- | drivers/target/target_core_tmr.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index dcb0618c9388..a5c2e41debf8 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c @@ -150,7 +150,7 @@ static void core_tmr_drain_tmr_list( continue; spin_lock(&cmd->t_state_lock); - if (!atomic_read(&cmd->t_transport_active)) { + if (!(cmd->transport_state & CMD_T_ACTIVE)) { spin_unlock(&cmd->t_state_lock); continue; } @@ -255,15 +255,15 @@ static void core_tmr_drain_task_list( cmd->t_task_cdb[0]); pr_debug("LUN_RESET: ITT[0x%08x] - pr_res_key: 0x%016Lx" " t_task_cdbs: %d t_task_cdbs_left: %d" - " t_task_cdbs_sent: %d -- t_transport_active: %d" - " t_transport_stop: %d t_transport_sent: %d\n", + " t_task_cdbs_sent: %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, cmd->t_task_list_num, atomic_read(&cmd->t_task_cdbs_left), atomic_read(&cmd->t_task_cdbs_sent), - atomic_read(&cmd->t_transport_active), - atomic_read(&cmd->t_transport_stop), - atomic_read(&cmd->t_transport_sent)); + (cmd->transport_state & CMD_T_ACTIVE) != 0, + (cmd->transport_state & CMD_T_STOP) != 0, + (cmd->transport_state & CMD_T_SENT) != 0); /* * If the command may be queued onto a workqueue cancel it now. @@ -287,19 +287,19 @@ static void core_tmr_drain_task_list( } fe_count = atomic_read(&cmd->t_fe_count); - if (atomic_read(&cmd->t_transport_active)) { - pr_debug("LUN_RESET: got t_transport_active = 1 for" + if (!(cmd->transport_state & CMD_T_ACTIVE)) { + pr_debug("LUN_RESET: got CMD_T_ACTIVE for" " task: %p, t_fe_count: %d dev: %p\n", task, fe_count, dev); - atomic_set(&cmd->t_transport_aborted, 1); + cmd->transport_state |= CMD_T_ABORTED; spin_unlock_irqrestore(&cmd->t_state_lock, flags); core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); continue; } - pr_debug("LUN_RESET: Got t_transport_active = 0 for task: %p," + pr_debug("LUN_RESET: Got !CMD_T_ACTIVE for task: %p," " t_fe_count: %d dev: %p\n", task, fe_count, dev); - atomic_set(&cmd->t_transport_aborted, 1); + cmd->transport_state |= CMD_T_ABORTED; spin_unlock_irqrestore(&cmd->t_state_lock, flags); core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); @@ -339,7 +339,7 @@ static void core_tmr_drain_cmd_list( if (prout_cmd == cmd) continue; - atomic_set(&cmd->t_transport_queue_active, 0); + cmd->transport_state &= ~CMD_T_QUEUED; atomic_dec(&qobj->queue_cnt); list_move_tail(&cmd->se_queue_node, &drain_cmd_list); } |