|
From: <vl...@us...> - 2014-07-19 04:08:33
|
Revision: 5684
http://sourceforge.net/p/scst/svn/5684
Author: vlnb
Date: 2014-07-19 04:08:30 +0000 (Sat, 19 Jul 2014)
Log Message:
-----------
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 <bva...@ac...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2014-07-19 03:54:33 UTC (rev 5683)
+++ trunk/scst/src/scst_targ.c 2014-07-19 04:08:30 UTC (rev 5684)
@@ -4845,7 +4845,6 @@
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 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|