mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 03:01:26 +00:00
Revert r4922, because it isn't fully correct
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4929 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1872,18 +1872,12 @@ struct scst_cmd {
|
||||
** Cmd's flags
|
||||
*************************************************************/
|
||||
|
||||
/* Set if cmd was sent for execution to optimize aborts waiting */
|
||||
/*
|
||||
* Set if expected_sn should be incremented, i.e. cmd was sent
|
||||
* for execution
|
||||
*/
|
||||
unsigned int sent_for_exec:1;
|
||||
|
||||
/* Set if cmd passed scst_inc_expected_sn() */
|
||||
unsigned int expected_sn_check_passed:1;
|
||||
|
||||
/* Set if cmd's SN was set */
|
||||
unsigned int sn_set:1;
|
||||
|
||||
/* Set if increment expected_sn in cmd->scst_cmd_done() */
|
||||
unsigned int inc_expected_sn_on_done:1;
|
||||
|
||||
/* Set if the cmd's action is completed */
|
||||
unsigned int completed:1;
|
||||
|
||||
@@ -1961,6 +1955,9 @@ struct scst_cmd {
|
||||
*/
|
||||
unsigned int preprocessing_only:1;
|
||||
|
||||
/* Set if cmd's SN was set */
|
||||
unsigned int sn_set:1;
|
||||
|
||||
/* Set if hq_cmd_count was incremented */
|
||||
unsigned int hq_cmd_inced:1;
|
||||
|
||||
@@ -1983,6 +1980,9 @@ struct scst_cmd {
|
||||
/* Set if the cmd was done or aborted out of its SN */
|
||||
unsigned int out_of_sn:1;
|
||||
|
||||
/* Set if increment expected_sn in cmd->scst_cmd_done() */
|
||||
unsigned int inc_expected_sn_on_done:1;
|
||||
|
||||
/* Set if tgt_sn field is valid */
|
||||
unsigned int tgt_sn_set:1;
|
||||
|
||||
|
||||
@@ -5434,9 +5434,8 @@ void scst_free_cmd(struct scst_cmd *cmd)
|
||||
|
||||
if (likely(cmd->tgt_dev != NULL)) {
|
||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||
if (unlikely(!cmd->expected_sn_check_passed) && cmd->sn_set &&
|
||||
!cmd->internal && !cmd->out_of_sn) {
|
||||
PRINT_ERROR("Finishing not SN checked cmd %p (opcode "
|
||||
if (unlikely(!cmd->sent_for_exec) && !cmd->internal) {
|
||||
PRINT_ERROR("Finishing not executed cmd %p (opcode "
|
||||
"%d, target %s, LUN %lld, sn %d, expected_sn %d)",
|
||||
cmd, cmd->cdb[0], cmd->tgtt->name,
|
||||
(long long unsigned int)cmd->lun,
|
||||
|
||||
@@ -2552,9 +2552,6 @@ bool scst_inc_expected_sn(struct scst_cmd *cmd)
|
||||
*/
|
||||
|
||||
EXTRACHECKS_BUG_ON(!cmd->sn_set);
|
||||
EXTRACHECKS_BUG_ON(cmd->expected_sn_check_passed);
|
||||
|
||||
cmd->expected_sn_check_passed = 1;
|
||||
|
||||
/*
|
||||
* Optimized for lockless fast path of sequence of SIMPLE or
|
||||
@@ -2618,8 +2615,8 @@ static struct scst_cmd *scst_post_exec_sn(struct scst_cmd *cmd,
|
||||
bool make_active)
|
||||
{
|
||||
/* For HQ commands SN is not set */
|
||||
bool inc_expected_sn = !cmd->inc_expected_sn_on_done && cmd->sn_set &&
|
||||
!cmd->expected_sn_check_passed && !cmd->retry;
|
||||
bool inc_expected_sn = !cmd->inc_expected_sn_on_done &&
|
||||
cmd->sn_set && !cmd->retry;
|
||||
struct scst_cmd *res = NULL;
|
||||
|
||||
TRACE_ENTRY();
|
||||
@@ -3489,7 +3486,7 @@ static int scst_dev_done(struct scst_cmd *cmd)
|
||||
|
||||
scst_check_unblock_dev(cmd);
|
||||
|
||||
if (cmd->inc_expected_sn_on_done && cmd->sn_set) {
|
||||
if (cmd->inc_expected_sn_on_done && cmd->sent_for_exec && cmd->sn_set) {
|
||||
bool rc = scst_inc_expected_sn(cmd);
|
||||
if (rc)
|
||||
scst_make_deferred_commands_active(cmd->cur_order_data);
|
||||
@@ -3557,10 +3554,11 @@ static int scst_pre_xmit_response(struct scst_cmd *cmd)
|
||||
if (unlikely(cmd->queue_type == SCST_CMD_QUEUE_HEAD_OF_QUEUE))
|
||||
scst_on_hq_cmd_response(cmd);
|
||||
|
||||
if (unlikely(!cmd->expected_sn_check_passed)) {
|
||||
TRACE_SN("cmd %p was not SN passed (sn %d, set %d)",
|
||||
if (unlikely(!cmd->sent_for_exec)) {
|
||||
TRACE_SN("cmd %p was not sent for exec (sn %d, set %d)",
|
||||
cmd, cmd->sn, cmd->sn_set);
|
||||
scst_unblock_deferred(cmd->cur_order_data, cmd);
|
||||
cmd->sent_for_exec = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3870,15 +3868,12 @@ static void scst_cmd_set_sn(struct scst_cmd *cmd)
|
||||
cmd->queue_type = SCST_CMD_QUEUE_ORDERED;
|
||||
#endif
|
||||
|
||||
if ((cmd->dev->queue_alg == SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER) &&
|
||||
(likely(cmd->queue_type != SCST_CMD_QUEUE_HEAD_OF_QUEUE))) {
|
||||
if (cmd->dev->queue_alg == SCST_CONTR_MODE_QUEUE_ALG_RESTRICTED_REORDER) {
|
||||
/*
|
||||
* Not the best way, but good enough until there is a
|
||||
* possibility to specify queue type during pass-through
|
||||
* commands submission.
|
||||
*/
|
||||
TRACE_SN("Restricted reorder dev %s (cmd %p)",
|
||||
cmd->dev->virt_name, cmd);
|
||||
cmd->queue_type = SCST_CMD_QUEUE_ORDERED;
|
||||
}
|
||||
|
||||
@@ -3918,11 +3913,6 @@ again:
|
||||
TRACE_SN("New sn_cmd_count: %d", atomic_read(&order_data->sn_cmd_count));
|
||||
break;
|
||||
|
||||
case SCST_CMD_QUEUE_UNTAGGED: /* put here with goto for better fast path */
|
||||
/* It is processed further as SIMPLE */
|
||||
cmd->queue_type = SCST_CMD_QUEUE_SIMPLE;
|
||||
goto again;
|
||||
|
||||
case SCST_CMD_QUEUE_ORDERED:
|
||||
TRACE_SN("ORDERED cmd %p (op %x)", cmd, cmd->cdb[0]);
|
||||
ordered:
|
||||
@@ -3945,6 +3935,11 @@ ordered:
|
||||
cmd->hq_cmd_inced = 1;
|
||||
goto out;
|
||||
|
||||
case SCST_CMD_QUEUE_UNTAGGED: /* put here with goto for better fast path */
|
||||
/* It is processed as SIMPLE */
|
||||
cmd->queue_type = SCST_CMD_QUEUE_SIMPLE;
|
||||
goto again;
|
||||
|
||||
default:
|
||||
sBUG();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user