Commit 6f04c513 authored by Bart Van Assche's avatar Bart Van Assche Committed by Sasha Levin

target: Remove first argument of target_{get,put}_sess_cmd()

[ Upstream commit afc16604 ]

The first argument of these two functions is always identical
to se_cmd->se_sess. Hence remove the first argument.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: <qla2xxx-upstream@qlogic.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 988ba675
...@@ -1349,7 +1349,7 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn, ...@@ -1349,7 +1349,7 @@ isert_handle_scsi_cmd(struct isert_conn *isert_conn,
if (!rc && dump_payload == false && unsol_data) if (!rc && dump_payload == false && unsol_data)
iscsit_set_unsoliticed_dataout(cmd); iscsit_set_unsoliticed_dataout(cmd);
else if (dump_payload && imm_data) else if (dump_payload && imm_data)
target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd); target_put_sess_cmd(&cmd->se_cmd);
return 0; return 0;
} }
...@@ -1774,7 +1774,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd, bool comp_err) ...@@ -1774,7 +1774,7 @@ isert_put_cmd(struct isert_cmd *isert_cmd, bool comp_err)
cmd->se_cmd.t_state == TRANSPORT_WRITE_PENDING) { cmd->se_cmd.t_state == TRANSPORT_WRITE_PENDING) {
struct se_cmd *se_cmd = &cmd->se_cmd; struct se_cmd *se_cmd = &cmd->se_cmd;
target_put_sess_cmd(se_cmd->se_sess, se_cmd); target_put_sess_cmd(se_cmd);
} }
} }
...@@ -1947,7 +1947,7 @@ isert_completion_rdma_read(struct iser_tx_desc *tx_desc, ...@@ -1947,7 +1947,7 @@ isert_completion_rdma_read(struct iser_tx_desc *tx_desc,
spin_unlock_bh(&cmd->istate_lock); spin_unlock_bh(&cmd->istate_lock);
if (ret) { if (ret) {
target_put_sess_cmd(se_cmd->se_sess, se_cmd); target_put_sess_cmd(se_cmd);
transport_send_check_condition_and_sense(se_cmd, transport_send_check_condition_and_sense(se_cmd,
se_cmd->pi_err, 0); se_cmd->pi_err, 0);
} else { } else {
......
...@@ -1334,7 +1334,7 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) ...@@ -1334,7 +1334,7 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx)
BUG_ON(ch->sess == NULL); BUG_ON(ch->sess == NULL);
target_put_sess_cmd(ch->sess, &ioctx->cmd); target_put_sess_cmd(&ioctx->cmd);
goto out; goto out;
} }
...@@ -1365,11 +1365,11 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx) ...@@ -1365,11 +1365,11 @@ static int srpt_abort_cmd(struct srpt_send_ioctx *ioctx)
* not been received in time. * not been received in time.
*/ */
srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx); srpt_unmap_sg_to_ib_sge(ioctx->ch, ioctx);
target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd); target_put_sess_cmd(&ioctx->cmd);
break; break;
case SRPT_STATE_MGMT_RSP_SENT: case SRPT_STATE_MGMT_RSP_SENT:
srpt_set_cmd_state(ioctx, SRPT_STATE_DONE); srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd); target_put_sess_cmd(&ioctx->cmd);
break; break;
default: default:
WARN(1, "Unexpected command state (%d)", state); WARN(1, "Unexpected command state (%d)", state);
...@@ -1679,7 +1679,7 @@ static int srpt_check_stop_free(struct se_cmd *cmd) ...@@ -1679,7 +1679,7 @@ static int srpt_check_stop_free(struct se_cmd *cmd)
struct srpt_send_ioctx *ioctx = container_of(cmd, struct srpt_send_ioctx *ioctx = container_of(cmd,
struct srpt_send_ioctx, cmd); struct srpt_send_ioctx, cmd);
return target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd); return target_put_sess_cmd(&ioctx->cmd);
} }
/** /**
...@@ -3074,7 +3074,7 @@ static void srpt_queue_response(struct se_cmd *cmd) ...@@ -3074,7 +3074,7 @@ static void srpt_queue_response(struct se_cmd *cmd)
ioctx->tag); ioctx->tag);
srpt_unmap_sg_to_ib_sge(ch, ioctx); srpt_unmap_sg_to_ib_sge(ch, ioctx);
srpt_set_cmd_state(ioctx, SRPT_STATE_DONE); srpt_set_cmd_state(ioctx, SRPT_STATE_DONE);
target_put_sess_cmd(ioctx->ch->sess, &ioctx->cmd); target_put_sess_cmd(&ioctx->cmd);
} }
} }
......
...@@ -429,7 +429,7 @@ static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd) ...@@ -429,7 +429,7 @@ static int tcm_qla2xxx_check_stop_free(struct se_cmd *se_cmd)
cmd->cmd_flags |= BIT_14; cmd->cmd_flags |= BIT_14;
} }
return target_put_sess_cmd(se_cmd->se_sess, se_cmd); return target_put_sess_cmd(se_cmd);
} }
/* tcm_qla2xxx_release_cmd - Callback from TCM Core to release underlying /* tcm_qla2xxx_release_cmd - Callback from TCM Core to release underlying
......
...@@ -712,7 +712,7 @@ static int iscsit_add_reject_from_cmd( ...@@ -712,7 +712,7 @@ static int iscsit_add_reject_from_cmd(
*/ */
if (cmd->se_cmd.se_tfo != NULL) { if (cmd->se_cmd.se_tfo != NULL) {
pr_debug("iscsi reject: calling target_put_sess_cmd >>>>>>\n"); pr_debug("iscsi reject: calling target_put_sess_cmd >>>>>>\n");
target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd); target_put_sess_cmd(&cmd->se_cmd);
} }
return -1; return -1;
} }
...@@ -998,7 +998,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -998,7 +998,7 @@ int iscsit_setup_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
hdr->cmdsn, be32_to_cpu(hdr->data_length), payload_length, hdr->cmdsn, be32_to_cpu(hdr->data_length), payload_length,
conn->cid); conn->cid);
target_get_sess_cmd(conn->sess->se_sess, &cmd->se_cmd, true); target_get_sess_cmd(&cmd->se_cmd, true);
cmd->sense_reason = transport_lookup_cmd_lun(&cmd->se_cmd, cmd->sense_reason = transport_lookup_cmd_lun(&cmd->se_cmd,
scsilun_to_int(&hdr->lun)); scsilun_to_int(&hdr->lun));
...@@ -1064,7 +1064,7 @@ int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -1064,7 +1064,7 @@ int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER)
return -1; return -1;
else if (cmdsn_ret == CMDSN_LOWER_THAN_EXP) { else if (cmdsn_ret == CMDSN_LOWER_THAN_EXP) {
target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd); target_put_sess_cmd(&cmd->se_cmd);
return 0; return 0;
} }
} }
...@@ -1080,7 +1080,7 @@ int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -1080,7 +1080,7 @@ int iscsit_process_scsi_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
if (!cmd->sense_reason) if (!cmd->sense_reason)
return 0; return 0;
target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd); target_put_sess_cmd(&cmd->se_cmd);
return 0; return 0;
} }
...@@ -1111,7 +1111,6 @@ static int ...@@ -1111,7 +1111,6 @@ static int
iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr,
bool dump_payload) bool dump_payload)
{ {
struct iscsi_conn *conn = cmd->conn;
int cmdsn_ret = 0, immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION; int cmdsn_ret = 0, immed_ret = IMMEDIATE_DATA_NORMAL_OPERATION;
/* /*
* Special case for Unsupported SAM WRITE Opcodes and ImmediateData=Yes. * Special case for Unsupported SAM WRITE Opcodes and ImmediateData=Yes.
...@@ -1138,7 +1137,7 @@ iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr, ...@@ -1138,7 +1137,7 @@ iscsit_get_immediate_data(struct iscsi_cmd *cmd, struct iscsi_scsi_req *hdr,
rc = iscsit_dump_data_payload(cmd->conn, rc = iscsit_dump_data_payload(cmd->conn,
cmd->first_burst_len, 1); cmd->first_burst_len, 1);
target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd); target_put_sess_cmd(&cmd->se_cmd);
return rc; return rc;
} else if (cmd->unsolicited_data) } else if (cmd->unsolicited_data)
iscsit_set_unsoliticed_dataout(cmd); iscsit_set_unsoliticed_dataout(cmd);
...@@ -1807,7 +1806,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -1807,7 +1806,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
conn->sess->se_sess, 0, DMA_NONE, conn->sess->se_sess, 0, DMA_NONE,
TCM_SIMPLE_TAG, cmd->sense_buffer + 2); TCM_SIMPLE_TAG, cmd->sense_buffer + 2);
target_get_sess_cmd(conn->sess->se_sess, &cmd->se_cmd, true); target_get_sess_cmd(&cmd->se_cmd, true);
sess_ref = true; sess_ref = true;
switch (function) { switch (function) {
...@@ -1949,7 +1948,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, ...@@ -1949,7 +1948,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
*/ */
if (sess_ref) { if (sess_ref) {
pr_debug("Handle TMR, using sess_ref=true check\n"); pr_debug("Handle TMR, using sess_ref=true check\n");
target_put_sess_cmd(conn->sess->se_sess, &cmd->se_cmd); target_put_sess_cmd(&cmd->se_cmd);
} }
iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state); iscsit_add_cmd_to_response_queue(cmd, conn, cmd->i_state);
......
...@@ -1981,7 +1981,7 @@ static void lio_set_default_node_attributes(struct se_node_acl *se_acl) ...@@ -1981,7 +1981,7 @@ static void lio_set_default_node_attributes(struct se_node_acl *se_acl)
static int lio_check_stop_free(struct se_cmd *se_cmd) static int lio_check_stop_free(struct se_cmd *se_cmd)
{ {
return target_put_sess_cmd(se_cmd->se_sess, se_cmd); return target_put_sess_cmd(se_cmd);
} }
static void lio_release_cmd(struct se_cmd *se_cmd) static void lio_release_cmd(struct se_cmd *se_cmd)
......
...@@ -746,7 +746,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) ...@@ -746,7 +746,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown)
rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown);
if (!rc && shutdown && se_cmd && se_cmd->se_sess) { if (!rc && shutdown && se_cmd && se_cmd->se_sess) {
__iscsit_free_cmd(cmd, true, shutdown); __iscsit_free_cmd(cmd, true, shutdown);
target_put_sess_cmd(se_cmd->se_sess, se_cmd); target_put_sess_cmd(se_cmd);
} }
break; break;
case ISCSI_OP_REJECT: case ISCSI_OP_REJECT:
...@@ -762,7 +762,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown) ...@@ -762,7 +762,7 @@ void iscsit_free_cmd(struct iscsi_cmd *cmd, bool shutdown)
rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown); rc = transport_generic_free_cmd(&cmd->se_cmd, shutdown);
if (!rc && shutdown && se_cmd->se_sess) { if (!rc && shutdown && se_cmd->se_sess) {
__iscsit_free_cmd(cmd, true, shutdown); __iscsit_free_cmd(cmd, true, shutdown);
target_put_sess_cmd(se_cmd->se_sess, se_cmd); target_put_sess_cmd(se_cmd);
} }
break; break;
} }
......
...@@ -153,7 +153,7 @@ void core_tmr_abort_task( ...@@ -153,7 +153,7 @@ void core_tmr_abort_task(
cancel_work_sync(&se_cmd->work); cancel_work_sync(&se_cmd->work);
transport_wait_for_tasks(se_cmd); transport_wait_for_tasks(se_cmd);
target_put_sess_cmd(se_sess, se_cmd); target_put_sess_cmd(se_cmd);
transport_cmd_finish_abort(se_cmd, true); transport_cmd_finish_abort(se_cmd, true);
printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for" printk("ABORT_TASK: Sending TMR_FUNCTION_COMPLETE for"
......
...@@ -1419,7 +1419,7 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess ...@@ -1419,7 +1419,7 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
* for fabrics using TARGET_SCF_ACK_KREF that expect a second * for fabrics using TARGET_SCF_ACK_KREF that expect a second
* kref_put() to happen during fabric packet acknowledgement. * kref_put() to happen during fabric packet acknowledgement.
*/ */
ret = target_get_sess_cmd(se_sess, se_cmd, (flags & TARGET_SCF_ACK_KREF)); ret = target_get_sess_cmd(se_cmd, flags & TARGET_SCF_ACK_KREF);
if (ret) if (ret)
return ret; return ret;
/* /*
...@@ -1433,7 +1433,7 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess ...@@ -1433,7 +1433,7 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
rc = transport_lookup_cmd_lun(se_cmd, unpacked_lun); rc = transport_lookup_cmd_lun(se_cmd, unpacked_lun);
if (rc) { if (rc) {
transport_send_check_condition_and_sense(se_cmd, rc, 0); transport_send_check_condition_and_sense(se_cmd, rc, 0);
target_put_sess_cmd(se_sess, se_cmd); target_put_sess_cmd(se_cmd);
return 0; return 0;
} }
...@@ -1584,7 +1584,7 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess, ...@@ -1584,7 +1584,7 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
se_cmd->se_tmr_req->ref_task_tag = tag; se_cmd->se_tmr_req->ref_task_tag = tag;
/* See target_submit_cmd for commentary */ /* See target_submit_cmd for commentary */
ret = target_get_sess_cmd(se_sess, se_cmd, (flags & TARGET_SCF_ACK_KREF)); ret = target_get_sess_cmd(se_cmd, flags & TARGET_SCF_ACK_KREF);
if (ret) { if (ret) {
core_tmr_release_req(se_cmd->se_tmr_req); core_tmr_release_req(se_cmd->se_tmr_req);
return ret; return ret;
...@@ -2227,7 +2227,7 @@ static int transport_release_cmd(struct se_cmd *cmd) ...@@ -2227,7 +2227,7 @@ static int transport_release_cmd(struct se_cmd *cmd)
* If this cmd has been setup with target_get_sess_cmd(), drop * If this cmd has been setup with target_get_sess_cmd(), drop
* the kref and call ->release_cmd() in kref callback. * the kref and call ->release_cmd() in kref callback.
*/ */
return target_put_sess_cmd(cmd->se_sess, cmd); return target_put_sess_cmd(cmd);
} }
/** /**
...@@ -2471,13 +2471,12 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks) ...@@ -2471,13 +2471,12 @@ int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
EXPORT_SYMBOL(transport_generic_free_cmd); EXPORT_SYMBOL(transport_generic_free_cmd);
/* target_get_sess_cmd - Add command to active ->sess_cmd_list /* target_get_sess_cmd - Add command to active ->sess_cmd_list
* @se_sess: session to reference
* @se_cmd: command descriptor to add * @se_cmd: command descriptor to add
* @ack_kref: Signal that fabric will perform an ack target_put_sess_cmd() * @ack_kref: Signal that fabric will perform an ack target_put_sess_cmd()
*/ */
int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, int target_get_sess_cmd(struct se_cmd *se_cmd, bool ack_kref)
bool ack_kref)
{ {
struct se_session *se_sess = se_cmd->se_sess;
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
...@@ -2499,7 +2498,7 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd, ...@@ -2499,7 +2498,7 @@ int target_get_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd,
spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
if (ret && ack_kref) if (ret && ack_kref)
target_put_sess_cmd(se_sess, se_cmd); target_put_sess_cmd(se_cmd);
return ret; return ret;
} }
...@@ -2528,11 +2527,12 @@ static void target_release_cmd_kref(struct kref *kref) ...@@ -2528,11 +2527,12 @@ static void target_release_cmd_kref(struct kref *kref)
} }
/* target_put_sess_cmd - Check for active I/O shutdown via kref_put /* target_put_sess_cmd - Check for active I/O shutdown via kref_put
* @se_sess: session to reference
* @se_cmd: command descriptor to drop * @se_cmd: command descriptor to drop
*/ */
int target_put_sess_cmd(struct se_session *se_sess, struct se_cmd *se_cmd) int target_put_sess_cmd(struct se_cmd *se_cmd)
{ {
struct se_session *se_sess = se_cmd->se_sess;
if (!se_sess) { if (!se_sess) {
se_cmd->se_tfo->release_cmd(se_cmd); se_cmd->se_tfo->release_cmd(se_cmd);
return 1; return 1;
......
...@@ -607,7 +607,7 @@ static void vhost_scsi_free_cmd(struct vhost_scsi_cmd *cmd) ...@@ -607,7 +607,7 @@ static void vhost_scsi_free_cmd(struct vhost_scsi_cmd *cmd)
static int vhost_scsi_check_stop_free(struct se_cmd *se_cmd) static int vhost_scsi_check_stop_free(struct se_cmd *se_cmd)
{ {
return target_put_sess_cmd(se_cmd->se_sess, se_cmd); return target_put_sess_cmd(se_cmd);
} }
static void static void
......
...@@ -155,8 +155,8 @@ bool transport_wait_for_tasks(struct se_cmd *); ...@@ -155,8 +155,8 @@ bool transport_wait_for_tasks(struct se_cmd *);
int transport_check_aborted_status(struct se_cmd *, int); int transport_check_aborted_status(struct se_cmd *, int);
int transport_send_check_condition_and_sense(struct se_cmd *, int transport_send_check_condition_and_sense(struct se_cmd *,
sense_reason_t, int); sense_reason_t, int);
int target_get_sess_cmd(struct se_session *, struct se_cmd *, bool); int target_get_sess_cmd(struct se_cmd *, bool);
int target_put_sess_cmd(struct se_session *, struct se_cmd *); int target_put_sess_cmd(struct se_cmd *);
void target_sess_cmd_list_set_waiting(struct se_session *); void target_sess_cmd_list_set_waiting(struct se_session *);
void target_wait_for_sess_cmds(struct se_session *); void target_wait_for_sess_cmds(struct se_session *);
......
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