DMAResource::TranslateNext(), in case of given physical vecs:

* segmentCount was potentially set incorrectly. It could be too big,
  since we considered all vecs, not only those remaining.
* The main loop condition was incorrect. This would lead to too few
  DMABuffer vecs (or none at all) for any but the first IOOperation of a
  request. Should fix #2586.
* Correctly offset by vecIndex in debug output.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26881 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-08-08 23:15:21 +00:00
parent 4ef471dec0
commit b328324d19

View File

@ -444,14 +444,15 @@ DMAResource::TranslateNext(IORequest* request, IOOperation* operation)
// We do already have physical addresses.
locker.Unlock();
vecs = buffer->Vecs();
segmentCount = min_c(buffer->VecCount(),
segmentCount = min_c(buffer->VecCount() - vecIndex,
fRestrictions.max_segment_count);
}
#ifdef TRACE_DMA_RESOURCE
TRACE(" physical count %lu\n", segmentCount);
for (uint32 i = 0; i < segmentCount; i++) {
TRACE(" [%lu] %p, %lu\n", i, vecs[i].iov_base, vecs[i].iov_len);
TRACE(" [%lu] %p, %lu\n", i, vecs[vecIndex + i].iov_base,
vecs[vecIndex + i].iov_len);
}
#endif
@ -488,7 +489,7 @@ DMAResource::TranslateNext(IORequest* request, IOOperation* operation)
"%lu\n", offset, length);
}
for (uint32 i = vecIndex; i < segmentCount;) {
for (uint32 i = vecIndex; i < vecIndex + segmentCount;) {
if (dmaBuffer->VecCount() >= fRestrictions.max_segment_count)
break;