mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
target: Avoid extra t_state_lock access in __target_execute_cmd
This patch makes target_execute_cmd() set CMD_T_BUSY|CMD_T_SENT while holding se_cmd->t_state_lock, in order to avoid the extra aquire/release in __target_execute_cmd(). It also clears these bits in case of a target_handle_task_attr() failure. Cc: Christoph Hellwig <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Kent Overstreet <[email protected]> Cc: Or Gerlitz <[email protected]> Cc: Moussa Ba <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
c1c35d5225
commit
1a398b9731
1 changed files with 9 additions and 7 deletions
|
|
@ -1580,10 +1580,6 @@ static void __target_execute_cmd(struct se_cmd *cmd)
|
|||
{
|
||||
sense_reason_t ret;
|
||||
|
||||
spin_lock_irq(&cmd->t_state_lock);
|
||||
cmd->transport_state |= (CMD_T_BUSY|CMD_T_SENT);
|
||||
spin_unlock_irq(&cmd->t_state_lock);
|
||||
|
||||
if (cmd->execute_cmd) {
|
||||
ret = cmd->execute_cmd(cmd);
|
||||
if (ret) {
|
||||
|
|
@ -1690,11 +1686,17 @@ void target_execute_cmd(struct se_cmd *cmd)
|
|||
}
|
||||
|
||||
cmd->t_state = TRANSPORT_PROCESSING;
|
||||
cmd->transport_state |= CMD_T_ACTIVE;
|
||||
cmd->transport_state |= CMD_T_ACTIVE|CMD_T_BUSY|CMD_T_SENT;
|
||||
spin_unlock_irq(&cmd->t_state_lock);
|
||||
|
||||
if (!target_handle_task_attr(cmd))
|
||||
__target_execute_cmd(cmd);
|
||||
if (target_handle_task_attr(cmd)) {
|
||||
spin_lock_irq(&cmd->t_state_lock);
|
||||
cmd->transport_state &= ~CMD_T_BUSY|CMD_T_SENT;
|
||||
spin_unlock_irq(&cmd->t_state_lock);
|
||||
return;
|
||||
}
|
||||
|
||||
__target_execute_cmd(cmd);
|
||||
}
|
||||
EXPORT_SYMBOL(target_execute_cmd);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue