haiku/headers/private/kernel/file_cache.h
Axel Dörfler 6d4aea4796 bonefish+axeld:
* Removed the vm_cache/vm_store ref_count duality that besides being a bit ugly
  also created the page dameon cache retrieval problem: now, only areas (and
  cache consumers) retrieve a reference to the store (and therefore, the vnode).
  The page daemon doesn't need to care about this at all anymore, and the pseudo
  references of the vm_cache could be removed again.
* Rearranged deletion of vnodes such that its ID can be reused directly after
  fs_remove_vnode() has been called.
* vm_page_allocate_page() no longer panics when it runs out of pages, but just
  waits for new pages to become available using the new sFreeCondition condition
  variable - to make sure this happens in an acceptable time frame, it'll
  trigger a run of the low memory handlers.
* Implemented a page_thief() that steals inactive pages from caches and puts
  them into the free queue. It runs as a low memory handler.
* The file cache now sets the usage count on the pages it inserts into the
  cache (needs some rework though, cache_io() doesn't do it yet).
* Instead of panicking, the kernel will currently dead lock in low memory
  situations, since BFS does a bit too much in bfs_release_vnode().
* Some minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22315 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-26 00:20:23 +00:00

57 lines
1.6 KiB
C

/*
* Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_FILE_CACHE_H
#define _KERNEL_FILE_CACHE_H
#include <vfs.h>
#include <vm_types.h>
#include <module.h>
// temporary/optional cache syscall API
#define CACHE_SYSCALLS "cache"
#define CACHE_CLEAR 1 // takes no parameters
#define CACHE_SET_MODULE 2 // gets the module name as parameter
#define CACHE_MODULES_NAME "file_cache"
#define FILE_CACHE_SEQUENTIAL_ACCESS 0x01
#define FILE_CACHE_LOADED_COMPLETELY 0x02
#define FILE_CACHE_NO_IO 0x04
struct cache_module_info {
module_info info;
void (*node_opened)(void *vnode, int32 fdType, dev_t mountID, ino_t parentID,
ino_t vnodeID, const char *name, off_t size);
void (*node_closed)(void *vnode, int32 fdType, dev_t mountID, ino_t vnodeID,
int32 accessType);
void (*node_launched)(size_t argCount, char * const *args);
};
#ifdef __cplusplus
extern "C" {
#endif
extern void cache_node_opened(void *vnode, int32 fdType, vm_cache *cache,
dev_t mountID, ino_t parentID, ino_t vnodeID, const char *name);
extern void cache_node_closed(void *vnode, int32 fdType, vm_cache *cache,
dev_t mountID, ino_t vnodeID);
extern void cache_node_launched(size_t argCount, char * const *args);
extern void cache_prefetch_vnode(void *vnode, off_t offset, size_t size);
extern void cache_prefetch(dev_t mountID, ino_t vnodeID, off_t offset, size_t size);
extern status_t file_cache_init_post_boot_device(void);
extern status_t file_cache_init(void);
extern vm_store *vm_create_vnode_store(struct vnode *vnode);
#ifdef __cplusplus
}
#endif
#endif /* _KRENEL_FILE_CACHE_H */