mirror of
https://review.haiku-os.org/haiku
synced 2025-02-02 03:36:14 +01:00
c8a342a476
a reference to a by them not yet referenced cache was not correct. They only incremented the reference count, but a vnode cache reference includes also a vnode reference. In case of the page daemon this would cause vnode references to be lost (causing bug #1465). * The page daemon used an unsafe method to access a yet unreferenced page cache. There was nothing that prevented the cache from being deleted while the page daemon tried to get a reference. The vm_page::cache field is now protected by the page cache table spinlock, too, which the new function vm_cache_acquire_page_cache_ref(), used by the page daemon, also acquires while trying to get the reference. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22208 a95241bf-73f2-0310-859d-f6bbb57e9c96
43 lines
1.3 KiB
C
43 lines
1.3 KiB
C
/*
|
|
* Copyright 2003-2007, Axel Dörfler, axeld@pinc-software.de.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
|
* Distributed under the terms of the NewOS License.
|
|
*/
|
|
#ifndef _KERNEL_VM_CACHE_H
|
|
#define _KERNEL_VM_CACHE_H
|
|
|
|
|
|
#include <kernel.h>
|
|
#include <vm.h>
|
|
|
|
struct kernel_args;
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
status_t vm_cache_init(struct kernel_args *args);
|
|
vm_cache *vm_cache_create(vm_store *store);
|
|
void vm_cache_acquire_ref(vm_cache *cache);
|
|
void vm_cache_release_ref(vm_cache *cache);
|
|
vm_cache *vm_cache_acquire_page_cache_ref(vm_page *page);
|
|
vm_page *vm_cache_lookup_page(vm_cache *cache, off_t page);
|
|
void vm_cache_insert_page(vm_cache *cache, vm_page *page, off_t offset);
|
|
void vm_cache_remove_page(vm_cache *cache, vm_page *page);
|
|
void vm_cache_remove_consumer(vm_cache *cache, vm_cache *consumer);
|
|
void vm_cache_add_consumer_locked(vm_cache *cache, vm_cache *consumer);
|
|
status_t vm_cache_write_modified(vm_cache *cache, bool fsReenter);
|
|
status_t vm_cache_set_minimal_commitment_locked(vm_cache *cache, off_t commitment);
|
|
status_t vm_cache_resize(vm_cache *cache, off_t newSize);
|
|
status_t vm_cache_insert_area_locked(vm_cache *cache, vm_area *area);
|
|
status_t vm_cache_remove_area(vm_cache *cache, vm_area *area);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _KERNEL_VM_CACHE_H */
|