Paranoia: vm_cache_insert_page() does now check whether a page for the

offset of the page to insert is already in the cache. Revealed the bug
fixed with my previous commit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21817 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2007-08-04 00:36:50 +00:00
parent 0a75dab5fe
commit fd772abcb4

View File

@ -294,6 +294,18 @@ vm_cache_insert_page(vm_cache *cache, vm_page *page, off_t offset)
state = disable_interrupts();
acquire_spinlock(&sPageCacheTableLock);
#if KDEBUG
struct page_lookup_key key;
key.offset = (uint32)(offset >> PAGE_SHIFT);
key.cache = cache;
vm_page* otherPage = (vm_page *)hash_lookup(sPageCacheTable, &key);
if (otherPage != NULL) {
panic("vm_cache_insert_page(): there's already page %p with cache "
"offset %lu in cache %p; inserting page %p", otherPage,
page->cache_offset, cache, page);
}
#endif // KDEBUG
hash_insert(sPageCacheTable, page);
release_spinlock(&sPageCacheTableLock);