diff --git a/sys/kern/vfs_hash.c b/sys/kern/vfs_hash.c index f1d4a91135c9..0271e49194d1 100644 --- a/sys/kern/vfs_hash.c +++ b/sys/kern/vfs_hash.c @@ -54,6 +54,13 @@ vfs_hashinit(void *dummy __unused) /* Must be SI_ORDER_SECOND so desiredvnodes is available */ SYSINIT(vfs_hash, SI_SUB_VFS, SI_ORDER_SECOND, vfs_hashinit, NULL); +u_int +vfs_hash_index(struct vnode *vp) +{ + + return (vp->v_hash + vp->v_mount->mnt_hashseed); +} + static struct vfs_hash_head * vfs_hash_bucket(const struct mount *mp, u_int hash) { diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index f841f82ecc37..ff00eac2c3f6 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -812,6 +812,7 @@ int fifo_printinfo(struct vnode *); typedef int vfs_hash_cmp_t(struct vnode *vp, void *arg); int vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg); +u_int vfs_hash_index(struct vnode *vp); int vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg); void vfs_hash_rehash(struct vnode *vp, u_int hash); void vfs_hash_remove(struct vnode *vp);