tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Vnode API change: add global vnode cache
Currently all file systems have to implement their own cache of
vnode / fs node pairs. Most file systems use a copy and pasted
version of ufs_ihash.
So add a global vnode cache with lookup and remove:
/*
* Lookup a vnode / fs node pair by key and return it referenced through vpp.
*/
int
vcache_lookup(struct mount *mp, void *key, size_t key_len, struct vnode **vpp)
/*
* Remove a vnode / fs node pair from the cache.
*/
void
vcache_remove(struct mount *mp, void *key, size_t key_len)
On cache miss vcache_lookup() will call a new vfs operation:
/*
* Read an inode from disk and initialize this vnode / inode pair.
* Caller assures no other thread will try to load this inode.
*/
int
vfs_load_node(struct mount *mp, struct vnode *vp,
const void *key, size_t key_len, void **new_key)
to load and initialize this vnode / fs node pair. The vnode cache
guarantees this call to be exclusive, no other thread will try to
load this vnode / fs node pair. The vnode will not appear on any
list before this operation completes.
Diff implementing this for file systems sharing ufs_ihash and replacing
VFS_VGET()/VOP_UNLOCK() sequences with vcache_lookup() is here:
http://www.netbsd.org/~hannken/vnode-pass6-1.diff
Comments or objections anyone?
--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig
(Germany)
Home |
Main Index |
Thread Index |
Old Index