diff options
Diffstat (limited to 'sys/kern/vfs_cache.c')
-rw-r--r-- | sys/kern/vfs_cache.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 3f92c8f..3459917 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -86,8 +86,8 @@ struct namecache { /* * Structures associated with name cacheing. */ -#define NCHHASH(dvp, hash) \ - (&nchashtbl[((dvp)->v_id + (hash)) & nchash]) +#define NCHHASH(hash) \ + (&nchashtbl[(hash) & nchash]) static LIST_HEAD(nchashhead, namecache) *nchashtbl; /* Hash Table */ static TAILQ_HEAD(, namecache) ncneg; /* Hash Table */ static u_long nchash; /* size of hash table */ @@ -208,8 +208,9 @@ cache_lookup(dvp, vpp, cnp) } } - hash = fnv32_hashbuf(cnp->cn_nameptr, cnp->cn_namelen); - LIST_FOREACH(ncp, (NCHHASH(dvp, hash)), nc_hash) { + hash = fnv_32_buf(cnp->cn_nameptr, cnp->cn_namelen, FNV1_32_INIT); + hash = fnv_32_buf(&dvp->v_id, sizeof(dvp->v_id), hash); + LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { numchecks++; if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) @@ -318,9 +319,10 @@ cache_enter(dvp, vp, cnp) ncp->nc_vp = vp; ncp->nc_dvp = dvp; len = ncp->nc_nlen = cnp->cn_namelen; - hash = fnv32_hashbuf(cnp->cn_nameptr, len); + hash = fnv_32_buf(cnp->cn_nameptr, len, FNV1_32_INIT); bcopy(cnp->cn_nameptr, ncp->nc_name, len); - ncpp = NCHHASH(dvp, hash); + hash = fnv_32_buf(&dvp->v_id, sizeof(dvp->v_id), hash); + ncpp = NCHHASH(hash); LIST_INSERT_HEAD(ncpp, ncp, nc_hash); if (LIST_EMPTY(&dvp->v_cache_src)) vhold(dvp); |