[stgt] [PATCH 1/3] NOT_LAST bit in cmd state, enables batch submission

Alexander Nezhinsky alexandern at mellanox.com
Mon Nov 7 16:09:57 CET 2011


To enable submitting batches of scsi commands by the backing stores,
NOT_LAST bit is added to the command state.
This integrates the batching feature seamlessly both for the LLDs and the
backing stores:
- the backing stores not supporting batched mode can safely disregard NOT_LAST
  bit and submit all commands separately (as previously);
- the LLDs can also ignore the bit and not set it at all, as the default
  value NOT_LAST=0 means that each command is "last" (i.e. separately submitted,
  in this context), so that even the backing stores which do support batching
  will make no attempt to batch it.
- when both LLD and BS support batching, the LLDs which accumulate scsi cmds
  may submit them marking all but the last one with NOT_LAST=1. The BS is
  hinted to queue the commands marked  with NOT_LAST=1 until a command marked
  NOT_LAST=0 is submitted, then all the commands previously queued can
  be submitted, if approppriate. The NOT_LAST=0 bit only instructs the BS that
  the currently available batch is complete, so that more commands may
  not arrive for quite a long time, but the BS may decide to actually
  separate or combine these "batches" according to its own algorithms.

Signed-off-by: Alexander Nezhinsky <alexandern at mellanox.com>
---
 usr/scsi_cmnd.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/usr/scsi_cmnd.h b/usr/scsi_cmnd.h
index c764c4e..6e3c6e2 100644
--- a/usr/scsi_cmnd.h
+++ b/usr/scsi_cmnd.h
@@ -100,6 +100,7 @@ enum {
 	TGT_CMD_QUEUED,
 	TGT_CMD_PROCESSED,
 	TGT_CMD_ASYNC,
+	TGT_CMD_NOT_LAST,
 };
 
 #define CMD_FNS(bit, name)						\
@@ -119,3 +120,4 @@ static inline int cmd_##name(const struct scsi_cmd *c)			\
 CMD_FNS(QUEUED, queued)
 CMD_FNS(PROCESSED, processed)
 CMD_FNS(ASYNC, async)
+CMD_FNS(NOT_LAST, not_last)
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list