Skip to content

Commit 3dca147

Browse files
rolanddNicholas Bellinger
authored andcommitted
target: Simplify command completion by removing CMD_T_FAILED flag
The CMD_T_FAILED flag is set used in one place to record the result of a trivial test, and it is only tested once, few lines later. We might as well make the code simpler and easier to read by directly doing the test of "success" where we want to use it. Signed-off-by: Roland Dreier <roland@purestorage.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent a80e21b commit 3dca147

2 files changed

Lines changed: 1 addition & 5 deletions

File tree

‎drivers/target/target_core_transport.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,6 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
669669
return;
670670
}
671671

672-
if (!success)
673-
cmd->transport_state |= CMD_T_FAILED;
674-
675672
/*
676673
* Check for case where an explicit ABORT_TASK has been received
677674
* and transport_wait_for_tasks() will be waiting for completion..
@@ -681,7 +678,7 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
681678
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
682679
complete(&cmd->t_transport_stop_comp);
683680
return;
684-
} else if (cmd->transport_state & CMD_T_FAILED) {
681+
} else if (!success) {
685682
INIT_WORK(&cmd->work, target_complete_failure_work);
686683
} else {
687684
INIT_WORK(&cmd->work, target_complete_ok_work);

‎include/target/target_core_base.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,6 @@ struct se_cmd {
525525
#define CMD_T_COMPLETE (1 << 2)
526526
#define CMD_T_SENT (1 << 4)
527527
#define CMD_T_STOP (1 << 5)
528-
#define CMD_T_FAILED (1 << 6)
529528
#define CMD_T_DEV_ACTIVE (1 << 7)
530529
#define CMD_T_REQUEST_STOP (1 << 8)
531530
#define CMD_T_BUSY (1 << 9)

0 commit comments

Comments
 (0)