summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_hash.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-01-14 05:41:40 +0000
committerkib <kib@FreeBSD.org>2013-01-14 05:41:40 +0000
commitb3d1d61e31adccd26b4386c4cffed34b1f632d09 (patch)
tree75a8ce6f566ad54b4e7ecbe4e098c6de9b9a63bf /sys/kern/vfs_hash.c
parentb11dfc2e2a448d92c8ab34d14d38bb059945ec07 (diff)
downloadFreeBSD-src-b3d1d61e31adccd26b4386c4cffed34b1f632d09.zip
FreeBSD-src-b3d1d61e31adccd26b4386c4cffed34b1f632d09.tar.gz
Add exported vfs_hash_index() function, which calculates the canonical
pre-masked hash for the given vnode. The function assumes that vp->v_hash is initialized by the filesystem vnode instantiation function. At the moment, it is only done if filesystem uses vfs_hash_insert(). Reviewed by: peter Tested by: peter, pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 5 days
Diffstat (limited to 'sys/kern/vfs_hash.c')
-rw-r--r--sys/kern/vfs_hash.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/vfs_hash.c b/sys/kern/vfs_hash.c
index f1d4a91..0271e49 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)
{
OpenPOWER on IntegriCloud