Commit 39c05f32 authored by Nicholas Bellinger's avatar Nicholas Bellinger

target: Remove session_reinstatement parameter from ->transport_wait_for_tasks

This patch removes the unnecessary session_reinstatement parameter from
se_cmd->transport_wait_for_tasks(), logic in transport_generic_wait_for_tasks,
and usage within iscsi-target code.

This also includes the removal of the 'bool' return from transport_put_cmd() +
transport_generic_free_cmd() that is no longer necessary.

Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 82f1c8a4
...@@ -3960,7 +3960,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) ...@@ -3960,7 +3960,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)
* iscsit_get_lun_for_cmd() in iscsit_handle_scsi_cmd(). * iscsit_get_lun_for_cmd() in iscsit_handle_scsi_cmd().
*/ */
if (cmd->tmr_req && se_cmd->transport_wait_for_tasks) if (cmd->tmr_req && se_cmd->transport_wait_for_tasks)
se_cmd->transport_wait_for_tasks(se_cmd, 1, 1); se_cmd->transport_wait_for_tasks(se_cmd, 1);
else if (cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) else if (cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD)
transport_release_cmd(se_cmd); transport_release_cmd(se_cmd);
else else
...@@ -3976,7 +3976,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn) ...@@ -3976,7 +3976,7 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)
se_cmd = &cmd->se_cmd; se_cmd = &cmd->se_cmd;
if (se_cmd->transport_wait_for_tasks) if (se_cmd->transport_wait_for_tasks)
se_cmd->transport_wait_for_tasks(se_cmd, 1, 1); se_cmd->transport_wait_for_tasks(se_cmd, 1);
spin_lock_bh(&conn->cmd_lock); spin_lock_bh(&conn->cmd_lock);
} }
......
...@@ -148,7 +148,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) ...@@ -148,7 +148,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess)
iscsit_release_cmd(cmd); iscsit_release_cmd(cmd);
else else
cmd->se_cmd.transport_wait_for_tasks( cmd->se_cmd.transport_wait_for_tasks(
&cmd->se_cmd, 1, 1); &cmd->se_cmd, 1);
spin_lock(&cr->conn_recovery_cmd_lock); spin_lock(&cr->conn_recovery_cmd_lock);
} }
spin_unlock(&cr->conn_recovery_cmd_lock); spin_unlock(&cr->conn_recovery_cmd_lock);
...@@ -175,7 +175,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess) ...@@ -175,7 +175,7 @@ void iscsit_free_connection_recovery_entires(struct iscsi_session *sess)
iscsit_release_cmd(cmd); iscsit_release_cmd(cmd);
else else
cmd->se_cmd.transport_wait_for_tasks( cmd->se_cmd.transport_wait_for_tasks(
&cmd->se_cmd, 1, 1); &cmd->se_cmd, 1);
spin_lock(&cr->conn_recovery_cmd_lock); spin_lock(&cr->conn_recovery_cmd_lock);
} }
spin_unlock(&cr->conn_recovery_cmd_lock); spin_unlock(&cr->conn_recovery_cmd_lock);
...@@ -265,7 +265,7 @@ void iscsit_discard_cr_cmds_by_expstatsn( ...@@ -265,7 +265,7 @@ void iscsit_discard_cr_cmds_by_expstatsn(
iscsit_release_cmd(cmd); iscsit_release_cmd(cmd);
else else
cmd->se_cmd.transport_wait_for_tasks( cmd->se_cmd.transport_wait_for_tasks(
&cmd->se_cmd, 1, 0); &cmd->se_cmd, 1);
spin_lock(&cr->conn_recovery_cmd_lock); spin_lock(&cr->conn_recovery_cmd_lock);
} }
spin_unlock(&cr->conn_recovery_cmd_lock); spin_unlock(&cr->conn_recovery_cmd_lock);
...@@ -324,7 +324,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsi_conn *conn) ...@@ -324,7 +324,7 @@ int iscsit_discard_unacknowledged_ooo_cmdsns_for_conn(struct iscsi_conn *conn)
iscsit_release_cmd(cmd); iscsit_release_cmd(cmd);
else else
cmd->se_cmd.transport_wait_for_tasks( cmd->se_cmd.transport_wait_for_tasks(
&cmd->se_cmd, 1, 1); &cmd->se_cmd, 1);
spin_lock_bh(&conn->cmd_lock); spin_lock_bh(&conn->cmd_lock);
} }
spin_unlock_bh(&conn->cmd_lock); spin_unlock_bh(&conn->cmd_lock);
...@@ -383,7 +383,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) ...@@ -383,7 +383,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn)
iscsit_release_cmd(cmd); iscsit_release_cmd(cmd);
else else
cmd->se_cmd.transport_wait_for_tasks( cmd->se_cmd.transport_wait_for_tasks(
&cmd->se_cmd, 1, 0); &cmd->se_cmd, 1);
spin_lock_bh(&conn->cmd_lock); spin_lock_bh(&conn->cmd_lock);
continue; continue;
} }
...@@ -409,7 +409,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) ...@@ -409,7 +409,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn)
iscsit_release_cmd(cmd); iscsit_release_cmd(cmd);
else else
cmd->se_cmd.transport_wait_for_tasks( cmd->se_cmd.transport_wait_for_tasks(
&cmd->se_cmd, 1, 1); &cmd->se_cmd, 1);
spin_lock_bh(&conn->cmd_lock); spin_lock_bh(&conn->cmd_lock);
continue; continue;
} }
...@@ -436,8 +436,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn) ...@@ -436,8 +436,7 @@ int iscsit_prepare_cmds_for_realligance(struct iscsi_conn *conn)
if ((cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) && if ((cmd->se_cmd.se_cmd_flags & SCF_SE_LUN_CMD) &&
cmd->se_cmd.transport_wait_for_tasks) cmd->se_cmd.transport_wait_for_tasks)
cmd->se_cmd.transport_wait_for_tasks(&cmd->se_cmd, cmd->se_cmd.transport_wait_for_tasks(&cmd->se_cmd, 0);
0, 0);
/* /*
* Add the struct iscsi_cmd to the connection recovery cmd list * Add the struct iscsi_cmd to the connection recovery cmd list
*/ */
......
...@@ -86,7 +86,7 @@ static u32 transport_allocate_tasks(struct se_cmd *cmd, ...@@ -86,7 +86,7 @@ static u32 transport_allocate_tasks(struct se_cmd *cmd,
enum dma_data_direction data_direction, enum dma_data_direction data_direction,
struct scatterlist *sgl, unsigned int nents); struct scatterlist *sgl, unsigned int nents);
static int transport_generic_get_mem(struct se_cmd *cmd); static int transport_generic_get_mem(struct se_cmd *cmd);
static bool transport_put_cmd(struct se_cmd *cmd); static void transport_put_cmd(struct se_cmd *cmd);
static void transport_remove_cmd_from_queue(struct se_cmd *cmd, static void transport_remove_cmd_from_queue(struct se_cmd *cmd,
struct se_queue_obj *qobj); struct se_queue_obj *qobj);
static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq); static int transport_set_sense_codes(struct se_cmd *cmd, u8 asc, u8 ascq);
...@@ -1638,7 +1638,7 @@ static int transport_check_alloc_task_attr(struct se_cmd *cmd) ...@@ -1638,7 +1638,7 @@ static int transport_check_alloc_task_attr(struct se_cmd *cmd)
return 0; return 0;
} }
static void transport_generic_wait_for_tasks(struct se_cmd *, int, int); static void transport_generic_wait_for_tasks(struct se_cmd *, int);
/* transport_generic_allocate_tasks(): /* transport_generic_allocate_tasks():
* *
...@@ -2504,7 +2504,7 @@ void transport_new_cmd_failure(struct se_cmd *se_cmd) ...@@ -2504,7 +2504,7 @@ void transport_new_cmd_failure(struct se_cmd *se_cmd)
spin_unlock_irqrestore(&se_cmd->t_state_lock, flags); spin_unlock_irqrestore(&se_cmd->t_state_lock, flags);
} }
static void transport_nop_wait_for_tasks(struct se_cmd *, int, int); static void transport_nop_wait_for_tasks(struct se_cmd *, int);
static inline u32 transport_get_sectors_6( static inline u32 transport_get_sectors_6(
unsigned char *cdb, unsigned char *cdb,
...@@ -3736,7 +3736,7 @@ static inline void transport_free_pages(struct se_cmd *cmd) ...@@ -3736,7 +3736,7 @@ static inline void transport_free_pages(struct se_cmd *cmd)
* *
* This routine releases our reference to the command and frees it if possible. * This routine releases our reference to the command and frees it if possible.
*/ */
static bool transport_put_cmd(struct se_cmd *cmd) static void transport_put_cmd(struct se_cmd *cmd)
{ {
unsigned long flags; unsigned long flags;
int free_tasks = 0; int free_tasks = 0;
...@@ -3764,10 +3764,9 @@ static bool transport_put_cmd(struct se_cmd *cmd) ...@@ -3764,10 +3764,9 @@ static bool transport_put_cmd(struct se_cmd *cmd)
transport_free_pages(cmd); transport_free_pages(cmd);
transport_release_cmd(cmd); transport_release_cmd(cmd);
return true; return;
out_busy: out_busy:
spin_unlock_irqrestore(&cmd->t_state_lock, flags); spin_unlock_irqrestore(&cmd->t_state_lock, flags);
return false;
} }
/* /*
...@@ -4331,7 +4330,7 @@ void transport_release_cmd(struct se_cmd *cmd) ...@@ -4331,7 +4330,7 @@ void transport_release_cmd(struct se_cmd *cmd)
} }
EXPORT_SYMBOL(transport_release_cmd); EXPORT_SYMBOL(transport_release_cmd);
bool transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) void transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
{ {
if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD))
transport_release_cmd(cmd); transport_release_cmd(cmd);
...@@ -4342,21 +4341,18 @@ bool transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) ...@@ -4342,21 +4341,18 @@ bool transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
transport_lun_remove_cmd(cmd); transport_lun_remove_cmd(cmd);
if (wait_for_tasks && cmd->transport_wait_for_tasks) if (wait_for_tasks && cmd->transport_wait_for_tasks)
cmd->transport_wait_for_tasks(cmd, 0, 0); cmd->transport_wait_for_tasks(cmd, 0);
transport_free_dev_tasks(cmd); transport_free_dev_tasks(cmd);
return transport_put_cmd(cmd); transport_put_cmd(cmd);
} }
return true;
} }
EXPORT_SYMBOL(transport_generic_free_cmd); EXPORT_SYMBOL(transport_generic_free_cmd);
static void transport_nop_wait_for_tasks( static void transport_nop_wait_for_tasks(
struct se_cmd *cmd, struct se_cmd *cmd,
int remove_cmd, int remove_cmd)
int session_reinstatement)
{ {
return; return;
} }
...@@ -4537,8 +4533,7 @@ int transport_clear_lun_from_sessions(struct se_lun *lun) ...@@ -4537,8 +4533,7 @@ int transport_clear_lun_from_sessions(struct se_lun *lun)
*/ */
static void transport_generic_wait_for_tasks( static void transport_generic_wait_for_tasks(
struct se_cmd *cmd, struct se_cmd *cmd,
int remove_cmd, int remove_cmd)
int session_reinstatement)
{ {
unsigned long flags; unsigned long flags;
...@@ -4614,13 +4609,7 @@ static void transport_generic_wait_for_tasks( ...@@ -4614,13 +4609,7 @@ static void transport_generic_wait_for_tasks(
if (!remove_cmd) if (!remove_cmd)
return; return;
if (!transport_generic_free_cmd(cmd, 0) && session_reinstatement) { transport_generic_free_cmd(cmd, 0);
unsigned long flags;
spin_lock_irqsave(&cmd->t_state_lock, flags);
transport_all_task_dev_remove_state(cmd);
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
}
} }
static int transport_get_sense_codes( static int transport_get_sense_codes(
......
...@@ -480,7 +480,7 @@ struct se_cmd { ...@@ -480,7 +480,7 @@ struct se_cmd {
struct target_core_fabric_ops *se_tfo; struct target_core_fabric_ops *se_tfo;
int (*transport_emulate_cdb)(struct se_cmd *); int (*transport_emulate_cdb)(struct se_cmd *);
void (*transport_split_cdb)(unsigned long long, u32, unsigned char *); void (*transport_split_cdb)(unsigned long long, u32, unsigned char *);
void (*transport_wait_for_tasks)(struct se_cmd *, int, int); void (*transport_wait_for_tasks)(struct se_cmd *, int);
void (*transport_complete_callback)(struct se_cmd *); void (*transport_complete_callback)(struct se_cmd *);
int (*transport_qf_callback)(struct se_cmd *); int (*transport_qf_callback)(struct se_cmd *);
......
...@@ -184,7 +184,7 @@ extern int transport_check_aborted_status(struct se_cmd *, int); ...@@ -184,7 +184,7 @@ extern int transport_check_aborted_status(struct se_cmd *, int);
extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int); extern int transport_send_check_condition_and_sense(struct se_cmd *, u8, int);
extern void transport_send_task_abort(struct se_cmd *); extern void transport_send_task_abort(struct se_cmd *);
extern void transport_release_cmd(struct se_cmd *); extern void transport_release_cmd(struct se_cmd *);
extern bool transport_generic_free_cmd(struct se_cmd *, int); extern void transport_generic_free_cmd(struct se_cmd *, int);
extern void transport_generic_wait_for_cmds(struct se_cmd *, int); extern void transport_generic_wait_for_cmds(struct se_cmd *, int);
extern int transport_init_task_sg(struct se_task *, struct se_mem *, u32); extern int transport_init_task_sg(struct se_task *, struct se_mem *, u32);
extern int transport_map_mem_to_sg(struct se_task *, struct list_head *, extern int transport_map_mem_to_sg(struct se_task *, struct list_head *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment