scst_cmd_aborted() is a bad and ambiguous name. Rename it to scst_cmd_aborted_on_xmit() and create a new version, which truly reflects its semantic.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4143 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-02-24 02:24:06 +00:00
parent 5160ddb148
commit 50120c37b3
9 changed files with 29 additions and 12 deletions

View File

@@ -223,7 +223,7 @@ int ft_send_response(struct scst_cmd *cmd)
ep = fc_seq_exch(fcmd->seq);
lport = ep->lp;
if (scst_cmd_aborted(cmd)) {
if (scst_cmd_aborted_on_xmit(cmd)) {
FT_IO_DBG("cmd aborted did %x oxid %x\n", ep->did, ep->oxid);
scst_set_delivery_status(cmd, SCST_CMD_DELIVERY_ABORTED);
goto done;

View File

@@ -439,7 +439,7 @@ static int ibmvstgt_xmit_response(struct scst_cmd *sc)
int ret;
enum dma_data_direction dir;
if (unlikely(scst_cmd_aborted(sc))) {
if (unlikely(scst_cmd_aborted_on_xmit(sc))) {
scst_set_delivery_status(sc, SCST_CMD_DELIVERY_ABORTED);
atomic_inc(&vport->req_lim_delta);
srp_iu_put(iue);

View File

@@ -3268,7 +3268,7 @@ static int iscsi_xmit_response(struct scst_cmd *scst_cmd)
EXTRACHECKS_BUG_ON(req->scst_state != ISCSI_CMD_STATE_RESTARTED);
if (unlikely(scst_cmd_aborted(scst_cmd)))
if (unlikely(scst_cmd_aborted_on_xmit(scst_cmd)))
set_bit(ISCSI_CMD_ABORTED, &req->prelim_compl_flags);
if (unlikely(req->prelim_compl_flags != 0)) {

View File

@@ -778,7 +778,7 @@ static int mvst_xmit_response(struct scst_cmd *scst_cmd)
sess = (struct mvst_sess *)
scst_sess_get_tgt_priv(scst_cmd_get_session(scst_cmd));
if (unlikely(scst_cmd_aborted(scst_cmd))) {
if (unlikely(scst_cmd_aborted_on_xmit(scst_cmd))) {
TRACE_MGMT_DBG("mvst tgt: terminating exchange "
"for aborted scst_cmd=%p (tag=%lld)",
scst_cmd, scst_cmd_get_tag(scst_cmd));

View File

@@ -2768,7 +2768,7 @@ static int q2x_xmit_response(struct scst_cmd *scst_cmd)
cmd->data_direction = scst_cmd_get_data_direction(scst_cmd);
cmd->dma_data_direction = scst_to_tgt_dma_dir(cmd->data_direction);
cmd->offset = scst_cmd_get_ppl_offset(scst_cmd);
cmd->aborted = scst_cmd_aborted(scst_cmd);
cmd->aborted = scst_cmd_aborted_on_xmit(scst_cmd);
q2t_check_srr_debug(cmd, &xmit_type);

View File

@@ -1188,7 +1188,7 @@ isp_xmit_response(struct scst_cmd *scst_cmd)
bus_t *bp = tmd->cd_bus;
tmd_xact_t *xact = &tmd->cd_xact;
if (unlikely(scst_cmd_aborted(scst_cmd))) {
if (unlikely(scst_cmd_aborted_on_xmit(scst_cmd))) {
scst_set_delivery_status(scst_cmd, SCST_CMD_DELIVERY_ABORTED);
scst_tgt_cmd_done(scst_cmd, SCST_CONTEXT_SAME);
return (SCST_TGT_RES_SUCCESS);

View File

@@ -3395,11 +3395,28 @@ static inline void scst_cmd_set_noio_mem_alloc(struct scst_cmd *cmd)
}
/*
* Returns 1 if the cmd was aborted, so its status is invalid and no
* reply shall be sent to the remote initiator. A target driver should
* only clear internal resources, associated with cmd.
* Returns true if the cmd was aborted, so the caller should complete it as
* soon as possible.
*
* !! Xmit_response() callback must use scst_cmd_aborted_on_xmit() instead !!
* !! to allow status of completed commands aborted by other initiators be !!
* !! delivered to their initiators !!
*/
static inline int scst_cmd_aborted(struct scst_cmd *cmd)
static inline bool scst_cmd_aborted(struct scst_cmd *cmd)
{
return test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags);
}
/*
* Returns true if the cmd was aborted by its initiator or aborted by another
* initiator and not completed, so its status is invalid and no reply shall
* be sent to the remote initiator. A target driver should only clear
* internal resources, associated with cmd.
*
* This functions shall be called by all target drivers in the beginning of
* xmit_response() callback.
*/
static inline bool scst_cmd_aborted_on_xmit(struct scst_cmd *cmd)
{
return test_bit(SCST_CMD_ABORTED, &cmd->cmd_flags) &&
!test_bit(SCST_CMD_ABORTED_OTHER, &cmd->cmd_flags);

View File

@@ -1289,7 +1289,7 @@ static int scst_local_targ_xmit_response(struct scst_cmd *scst_cmd)
TRACE_ENTRY();
if (unlikely(scst_cmd_aborted(scst_cmd))) {
if (unlikely(scst_cmd_aborted_on_xmit(scst_cmd))) {
scst_set_delivery_status(scst_cmd, SCST_CMD_DELIVERY_ABORTED);
scst_tgt_cmd_done(scst_cmd, SCST_CONTEXT_SAME);
return SCST_TGT_RES_SUCCESS;

View File

@@ -3214,7 +3214,7 @@ static int srpt_xmit_response(struct scst_cmd *scmnd)
}
spin_unlock(&ioctx->spinlock);
if (unlikely(scst_cmd_aborted(scmnd))) {
if (unlikely(scst_cmd_aborted_on_xmit(scmnd))) {
srpt_adjust_req_lim(ch, 0, 1);
srpt_abort_cmd(ioctx, SCST_CONTEXT_SAME);
goto out;