From 140972727f77ae91085be934ca5376a66676a7c9 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 13 Nov 2024 21:45:04 -0500 Subject: kernel: vfs: Add vnode cache implementation Signed-off-by: Ian Moffett --- sys/include/sys/sysctl.h | 1 + sys/include/sys/vnode.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+) (limited to 'sys/include') diff --git a/sys/include/sys/sysctl.h b/sys/include/sys/sysctl.h index 0f1df26..9623137 100644 --- a/sys/include/sys/sysctl.h +++ b/sys/include/sys/sysctl.h @@ -39,6 +39,7 @@ #define KERN_OSTYPE 0 #define KERN_OSRELEASE 1 #define KERN_VERSION 2 +#define KERN_VCACHE_TYPE 3 /* * Option types (i.e., int, string, etc) for diff --git a/sys/include/sys/vnode.h b/sys/include/sys/vnode.h index 3f3b011..33d5b17 100644 --- a/sys/include/sys/vnode.h +++ b/sys/include/sys/vnode.h @@ -31,6 +31,7 @@ #define _SYS_VNODE_H_ #include +#include #include #include @@ -44,10 +45,18 @@ struct vnode { void *data; const struct vops *vops; uint32_t refcount; + TAILQ_ENTRY(vnode) vcache_link; }; #define vfs_vref(VP) (atomic_inc_int(&(VP)->refcount)) +/* vcache types */ +#if defined(_KERNEL) +#define VCACHE_TYPE_NONE 0 +#define VCACHE_TYPE_PROC 1 +#define VCACHE_TYPE_GLOBAL 2 +#endif /* KERNEL */ + /* Vnode type flags */ #define VNON 0x00 /* Uninitialized */ #define VREG 0x01 /* Regular file */ @@ -86,6 +95,12 @@ struct vops { extern struct vnode *g_root_vnode; +int vfs_vcache_type(void); +int vfs_vcache_migrate(int newtype); + +int vfs_vcache_enter(struct vnode *vp); +struct vnode *vfs_recycle_vnode(void); + int vfs_alloc_vnode(struct vnode **res, int type); int vfs_release_vnode(struct vnode *vp); -- cgit v1.2.3