From 53b0609a4aacf359dbe15a0262e1ddfb59cf551c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 1 Dec 2004 07:41:07 +0000 Subject: [PATCH] Initial support for cache modules. Also fixed a minor bug in dec_vnode_ref_count(): the unusued vnode counter was not decremented again when one vnode was removed. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10336 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/fs/vfs.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/kernel/core/fs/vfs.cpp b/src/kernel/core/fs/vfs.cpp index 3a7f71df6a..409b84c96d 100755 --- a/src/kernel/core/fs/vfs.cpp +++ b/src/kernel/core/fs/vfs.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -52,7 +53,7 @@ #define MAX_SYM_LINKS SYMLINKS_MAX -const static uint32 kMaxUnusedVnodes = 512; +const static uint32 kMaxUnusedVnodes = 8192; // This is the maximum number of unused vnodes that the system // will keep around. // It may be chosen with respect to the available memory or enhanced @@ -645,10 +646,10 @@ dec_vnode_ref_count(struct vnode *vnode, bool reenter) // there are too many unused vnodes so we free the oldest one // ToDo: evaluate this mechanism vnode = (struct vnode *)list_remove_head_item(&sUnusedVnodeList); - hash_remove(sVnodeTable, vnode); vnode->busy = true; freeNode = true; + sUnusedVnodes--; } } @@ -1532,6 +1533,7 @@ get_new_fd(int type, struct vnode *vnode, fs_cookie cookie, int openMode, bool k return B_NO_MORE_FDS; } + cache_node_opened(vnode->cache, vnode->device, vnode->id); return fd; } @@ -2369,7 +2371,7 @@ vfs_init(kernel_args *args) if (mutex_init(&sVnodeMutex, "vfs_vnode_lock") < 0) panic("vfs_init: error allocating vnode lock\n"); - return 0; + return file_cache_init(); }