mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-22 05:01:27 +00:00
scst: Clean up scst_process_active_cmd()
Since inside scst_process_active_cmd() cmd->state can only change after cmd has been added back to the command list it is safe to perform the cmd->state check without holding the command list lock. Hence move the perform the cmd->state check without holding the command list lock. Signed-off-by: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5684 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -4845,7 +4845,6 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic)
|
||||
if (res == SCST_CMD_STATE_RES_CONT_NEXT) {
|
||||
/* None */
|
||||
} else if (res == SCST_CMD_STATE_RES_NEED_THREAD) {
|
||||
spin_lock_irq(&cmd->cmd_threads->cmd_list_lock);
|
||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||
switch (cmd->state) {
|
||||
case SCST_CMD_STATE_PARSE:
|
||||
@@ -4858,22 +4857,18 @@ void scst_process_active_cmd(struct scst_cmd *cmd, bool atomic)
|
||||
case SCST_CMD_STATE_REAL_EXEC:
|
||||
case SCST_CMD_STATE_DEV_DONE:
|
||||
case SCST_CMD_STATE_XMIT_RESP:
|
||||
#endif
|
||||
TRACE_DBG("Adding cmd %p to head of active cmd list",
|
||||
cmd);
|
||||
list_add(&cmd->cmd_list_entry,
|
||||
&cmd->cmd_threads->active_cmd_list);
|
||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||
break;
|
||||
default:
|
||||
PRINT_CRIT_ERROR("cmd %p is in invalid state %d)", cmd,
|
||||
cmd->state);
|
||||
#if !defined(__CHECKER__)
|
||||
spin_unlock_irq(&cmd->cmd_threads->cmd_list_lock);
|
||||
#endif
|
||||
sBUG();
|
||||
}
|
||||
#endif
|
||||
TRACE_DBG("Adding cmd %p to head of active cmd list", cmd);
|
||||
|
||||
spin_lock_irq(&cmd->cmd_threads->cmd_list_lock);
|
||||
list_add(&cmd->cmd_list_entry,
|
||||
&cmd->cmd_threads->active_cmd_list);
|
||||
wake_up(&cmd->cmd_threads->cmd_list_waitQ);
|
||||
spin_unlock_irq(&cmd->cmd_threads->cmd_list_lock);
|
||||
} else
|
||||
|
||||
Reference in New Issue
Block a user