浏览代码

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>
Roland Dreier 11 年之前
父节点
当前提交
3dca147199
共有 2 个文件被更改,包括 1 次插入5 次删除
  1. 1 4
      drivers/target/target_core_transport.c
  2. 0 1
      include/target/target_core_base.h

+ 1 - 4
drivers/target/target_core_transport.c

@@ -669,9 +669,6 @@ void target_complete_cmd(struct se_cmd *cmd, u8 scsi_status)
 		return;
 		return;
 	}
 	}
 
 
-	if (!success)
-		cmd->transport_state |= CMD_T_FAILED;
-
 	/*
 	/*
 	 * Check for case where an explicit ABORT_TASK has been received
 	 * Check for case where an explicit ABORT_TASK has been received
 	 * and transport_wait_for_tasks() will be waiting for completion..
 	 * 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)
 		spin_unlock_irqrestore(&cmd->t_state_lock, flags);
 		spin_unlock_irqrestore(&cmd->t_state_lock, flags);
 		complete(&cmd->t_transport_stop_comp);
 		complete(&cmd->t_transport_stop_comp);
 		return;
 		return;
-	} else if (cmd->transport_state & CMD_T_FAILED) {
+	} else if (!success) {
 		INIT_WORK(&cmd->work, target_complete_failure_work);
 		INIT_WORK(&cmd->work, target_complete_failure_work);
 	} else {
 	} else {
 		INIT_WORK(&cmd->work, target_complete_ok_work);
 		INIT_WORK(&cmd->work, target_complete_ok_work);

+ 0 - 1
include/target/target_core_base.h

@@ -525,7 +525,6 @@ struct se_cmd {
 #define CMD_T_COMPLETE		(1 << 2)
 #define CMD_T_COMPLETE		(1 << 2)
 #define CMD_T_SENT		(1 << 4)
 #define CMD_T_SENT		(1 << 4)
 #define CMD_T_STOP		(1 << 5)
 #define CMD_T_STOP		(1 << 5)
-#define CMD_T_FAILED		(1 << 6)
 #define CMD_T_DEV_ACTIVE	(1 << 7)
 #define CMD_T_DEV_ACTIVE	(1 << 7)
 #define CMD_T_REQUEST_STOP	(1 << 8)
 #define CMD_T_REQUEST_STOP	(1 << 8)
 #define CMD_T_BUSY		(1 << 9)
 #define CMD_T_BUSY		(1 << 9)