IOCache: adjust the last iovec when the capacity isn't multiple of B_PAGE_SIZE
Patch by mark_mcs, edited by me this fixes #16030 Change-Id: I9255fe960f73cdfc3fd2668cdaf7db19fedd70f1 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3451 Reviewed-by: Rene Gollent <rene@gollent.com>
This commit is contained in:
parent
5f51a74f1a
commit
00866cc149
@ -545,6 +545,12 @@ IOCache::_TransferPages(size_t firstPage, size_t pageCount, bool isWrite,
|
||||
}
|
||||
}
|
||||
|
||||
// Don't try to read past the end of the device just to fill a page;
|
||||
// this makes sure that sum(fVecs[].length) == requestLength
|
||||
generic_size_t padLength = B_PAGE_SIZE - requestLength % B_PAGE_SIZE;
|
||||
if (vecCount > 0 && padLength != B_PAGE_SIZE)
|
||||
fVecs[vecCount - 1].length -= padLength;
|
||||
|
||||
// create a request for the transfer
|
||||
IORequest request;
|
||||
status_t error = request.Init(firstPageOffset, fVecs, vecCount,
|
||||
|
Loading…
Reference in New Issue
Block a user