cache_io(): Also requeue the last touched page to keep things roughly LRU

sorted.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35530 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-02-20 10:51:53 +00:00
parent 62420a09d4
commit 9824ded0b0
+7 -7
View File
@@ -824,13 +824,6 @@ cache_io(void* _cacheRef, void* cookie, off_t offset, addr_t buffer,
cache->MarkPageUnbusy(page);
}
if (bytesLeft <= bytesInPage) {
// we've read the last page, so we're done!
locker.Unlock();
vm_page_unreserve_pages(&reservation);
return B_OK;
}
// If it is cached only, requeue the page, so the respective queue
// roughly remains LRU first sorted.
if (page->state == PAGE_STATE_CACHED
@@ -840,6 +833,13 @@ cache_io(void* _cacheRef, void* cookie, off_t offset, addr_t buffer,
DEBUG_PAGE_ACCESS_END(page);
}
if (bytesLeft <= bytesInPage) {
// we've read the last page, so we're done!
locker.Unlock();
vm_page_unreserve_pages(&reservation);
return B_OK;
}
// prepare a potential gap request
lastBuffer = buffer + bytesInPage;
lastLeft = bytesLeft - bytesInPage;