mirror of
https://github.com/SCST-project/scst.git
synced 2026-09-21 07:24:22 +00:00
iscsi-scst: Handle data buffers with non-zero offset correctly (merge r5683 from trunk)
git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@5687 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -1396,16 +1396,24 @@ retry:
|
||||
sg_size = size;
|
||||
|
||||
if (sg != write_cmnd->rsp_sg) {
|
||||
/*
|
||||
* Data scatterlist. It is assumed that only the first element
|
||||
* has a non-zero offset and that all elements except the
|
||||
* first and the last have a length that is equal to
|
||||
* PAGE_SIZE.
|
||||
*/
|
||||
offset = conn->write_offset + sg[0].offset;
|
||||
idx = offset >> PAGE_SHIFT;
|
||||
if (offset + sg[0].offset >= PAGE_SIZE)
|
||||
offset += sg[0].offset;
|
||||
offset &= ~PAGE_MASK;
|
||||
length = min(size, (int)PAGE_SIZE - offset);
|
||||
TRACE_WRITE("write_offset %d, sg_size %d, idx %d, offset %d, "
|
||||
"length %d", conn->write_offset, sg_size, idx, offset,
|
||||
length);
|
||||
} else {
|
||||
/*
|
||||
* Response scatterlist. No assumptions are made about the
|
||||
* offset nor about the length of scatterlist elements.
|
||||
*/
|
||||
idx = 0;
|
||||
offset = conn->write_offset;
|
||||
while (offset >= sg[idx].length) {
|
||||
|
||||
Reference in New Issue
Block a user