The reserved pages computation used the same broken logic as read_into_cache()

and write_to_cache() before, IOW the cache could reserve too few pages.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22859 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-11-08 14:44:13 +00:00
parent cfe386c2d5
commit 9edc2b526f

View File

@ -917,8 +917,8 @@ satisfy_cache_io(file_cache_ref *ref, cache_func function, off_t offset,
return B_OK;
size_t requestSize = buffer - lastBuffer;
reservePages = min_c(MAX_IO_VECS,
(lastLeft - requestSize + B_PAGE_SIZE - 1) >> PAGE_SHIFT);
reservePages = min_c(MAX_IO_VECS, (lastLeft - requestSize
+ lastPageOffset + B_PAGE_SIZE - 1) >> PAGE_SHIFT);
status_t status = function(ref, lastOffset, lastPageOffset, lastBuffer,
requestSize, lastReservedPages, reservePages);
@ -990,8 +990,8 @@ cache_io(void *_cacheRef, off_t offset, addr_t buffer, size_t *_size,
int32 lastPageOffset = pageOffset;
addr_t lastBuffer = buffer;
off_t lastOffset = offset;
size_t lastReservedPages = min_c(MAX_IO_VECS,
(bytesLeft + B_PAGE_SIZE - 1) >> PAGE_SHIFT);
size_t lastReservedPages = min_c(MAX_IO_VECS, (pageOffset + bytesLeft
+ B_PAGE_SIZE - 1) >> PAGE_SHIFT);
size_t reservePages = 0;
reserve_pages(ref, lastReservedPages, doWrite);