Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Apr 1997 20:49:14 +0900 (JST)
From:      Michael Hancock <michaelh@cet.co.jp>
To:        Poul-Henning Kamp <phk@dk.tfs.com>
Cc:        fs@freebsd.org
Subject:   Re: the namei cache... 
Message-ID:  <Pine.SV4.3.95.970424202555.13551A-100000@parkplace.cet.co.jp>
In-Reply-To: <801.861878478@critter>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 24 Apr 1997, Poul-Henning Kamp wrote:

> >With hashing you can work on the hashing algorithm.  Btw, what is the hash
> >key now?  vp+name[20]?
> 
> directory vnode v_id + the regular namei hash.

It's hard to tell how well keys are distributed.  The cn_hash component
seems like it can be improved, maybe by taking only 3 or 4 of the
characters in the name and then doing some shifts and xor's on them. 

	cnp->cn_hash = 0;
	for (cp = cnp->cn_nameptr; *cp != 0 && *cp != '/'; cp++)
		cnp->cn_hash += (unsigned char)*cp;
	cnp->cn_namelen = cp - cnp->cn_nameptr;
	if (cnp->cn_namelen > NAME_MAX) {
		error = ENAMETOOLONG;
		goto bad;
	}

Regarding the capability have you done any analysis on it's distribution?

Mike




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.95.970424202555.13551A-100000>