diff options
author | Boaz Harrosh <bharrosh@panasas.com> | 2007-12-13 06:50:53 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-30 14:03:41 -0500 |
commit | 6f9a35e2dafa0f855ab051c11bdbf739745ff6f5 (patch) | |
tree | 5ca273c98b61a4d329653ef30faa2c0414eccd2b /include/scsi/scsi_cmnd.h | |
parent | 30b0c37b27485a9cb897bfe3824f6f517b8c80d6 (diff) |
[SCSI] bidirectional command support
At the block level bidi request uses req->next_rq pointer for a second
bidi_read request.
At Scsi-midlayer a second scsi_data_buffer structure is used for the
bidi_read part. This bidi scsi_data_buffer is put on
request->next_rq->special. Struct scsi_cmnd is not changed.
- Define scsi_bidi_cmnd() to return true if it is a bidi request and a
second sgtable was allocated.
- Define scsi_in()/scsi_out() to return the in or out scsi_data_buffer
from this command This API is to isolate users from the mechanics of
bidi.
- Define scsi_end_bidi_request() to do what scsi_end_request() does but
for a bidi request. This is necessary because bidi commands are a bit
tricky here. (See comments in body)
- scsi_release_buffers() will also release the bidi_read scsi_data_buffer
- scsi_io_completion() on bidi commands will now call
scsi_end_bidi_request() and return.
- The previous work done in scsi_init_io() is now done in a new
scsi_init_sgtable() (which is 99% identical to old scsi_init_io())
The new scsi_init_io() will call the above twice if needed also for
the bidi_read command. Only at this point is a command bidi.
- In scsi_error.c at scsi_eh_prep/restore_cmnd() make sure bidi-lld is not
confused by a get-sense command that looks like bidi. This is done
by puting NULL at request->next_rq, and restoring.
[jejb: update to sg_table and resolve conflicts
also update to blk-end-request and resolve conflicts]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/scsi/scsi_cmnd.h')
-rw-r--r-- | include/scsi/scsi_cmnd.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index c6478bb6f963..de28aab820b0 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -2,12 +2,12 @@ | |||
2 | #define _SCSI_SCSI_CMND_H | 2 | #define _SCSI_SCSI_CMND_H |
3 | 3 | ||
4 | #include <linux/dma-mapping.h> | 4 | #include <linux/dma-mapping.h> |
5 | #include <linux/blkdev.h> | ||
5 | #include <linux/list.h> | 6 | #include <linux/list.h> |
6 | #include <linux/types.h> | 7 | #include <linux/types.h> |
7 | #include <linux/timer.h> | 8 | #include <linux/timer.h> |
8 | #include <linux/scatterlist.h> | 9 | #include <linux/scatterlist.h> |
9 | 10 | ||
10 | struct request; | ||
11 | struct Scsi_Host; | 11 | struct Scsi_Host; |
12 | struct scsi_device; | 12 | struct scsi_device; |
13 | 13 | ||
@@ -158,4 +158,21 @@ static inline int scsi_get_resid(struct scsi_cmnd *cmd) | |||
158 | #define scsi_for_each_sg(cmd, sg, nseg, __i) \ | 158 | #define scsi_for_each_sg(cmd, sg, nseg, __i) \ |
159 | for_each_sg(scsi_sglist(cmd), sg, nseg, __i) | 159 | for_each_sg(scsi_sglist(cmd), sg, nseg, __i) |
160 | 160 | ||
161 | static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd) | ||
162 | { | ||
163 | return blk_bidi_rq(cmd->request) && | ||
164 | (cmd->request->next_rq->special != NULL); | ||
165 | } | ||
166 | |||
167 | static inline struct scsi_data_buffer *scsi_in(struct scsi_cmnd *cmd) | ||
168 | { | ||
169 | return scsi_bidi_cmnd(cmd) ? | ||
170 | cmd->request->next_rq->special : &cmd->sdb; | ||
171 | } | ||
172 | |||
173 | static inline struct scsi_data_buffer *scsi_out(struct scsi_cmnd *cmd) | ||
174 | { | ||
175 | return &cmd->sdb; | ||
176 | } | ||
177 | |||
161 | #endif /* _SCSI_SCSI_CMND_H */ | 178 | #endif /* _SCSI_SCSI_CMND_H */ |