Ordered reads groupped under single config symbol.
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 19 Nov 2009 11:57:57 +0000 (11:57 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Thu, 19 Nov 2009 11:57:57 +0000 (11:57 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@1350 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/scst_targ.c

index a68f571..d7a3166 100644 (file)
 #include "scst.h"
 #include "scst_priv.h"
 
+#if 0 /* Temporary, left for future performance investigations */
+/* Deleting it don't forget to delete write_cmd_count */
+#define CONFIG_SCST_ORDERED_READS
+#endif
+
 static void scst_cmd_set_sn(struct scst_cmd *cmd);
 static int __scst_init_cmd(struct scst_cmd *cmd);
 static void scst_finish_cmd_mgmt(struct scst_cmd *cmd);
@@ -2855,10 +2860,11 @@ static int scst_pre_xmit_response(struct scst_cmd *cmd)
        if (likely(cmd->tgt_dev != NULL)) {
                atomic_dec(&cmd->tgt_dev->tgt_dev_cmd_count);
                atomic_dec(&cmd->dev->dev_cmd_count);
+#ifdef CONFIG_SCST_ORDERED_READS
                /* If expected values not set, expected direction is UNKNOWN */
                if (cmd->expected_data_direction & SCST_DATA_WRITE)
                        atomic_dec(&cmd->dev->write_cmd_count);
-
+#endif
                if (unlikely(cmd->queue_type == SCST_CMD_QUEUE_HEAD_OF_QUEUE))
                        scst_on_hq_cmd_response(cmd);
 
@@ -3136,7 +3142,7 @@ static void scst_cmd_set_sn(struct scst_cmd *cmd)
        switch (cmd->queue_type) {
        case SCST_CMD_QUEUE_SIMPLE:
        case SCST_CMD_QUEUE_UNTAGGED:
-#if 0 /* left for future performance investigations */
+#ifdef CONFIG_SCST_ORDERED_READS
                if (scst_cmd_is_expected_set(cmd)) {
                        if ((cmd->expected_data_direction == SCST_DATA_READ) &&
                            (atomic_read(&cmd->dev->write_cmd_count) == 0))
@@ -3332,9 +3338,11 @@ static int __scst_init_cmd(struct scst_cmd *cmd)
                        }
                }
 
+#ifdef CONFIG_SCST_ORDERED_READS
                /* If expected values not set, expected direction is UNKNOWN */
                if (cmd->expected_data_direction & SCST_DATA_WRITE)
                        atomic_inc(&cmd->dev->write_cmd_count);
+#endif
 
                if (unlikely(failure))
                        goto out_busy;