Re: dcache questions

Bill Hawes (whawes@star.net)
Wed, 31 Dec 1997 10:39:50 -0500


David C Niemi wrote:
>
> On Tue, 30 Dec 1997, Gordon Chaffee wrote:
> > Since d_ops->d_hash can be overridden, this is exactly what I am in
> > the process of doing for hashes. When a name gets hashed, a lookup is
> > done on the name if it is not found in the dcache. Short aliases will
> > always need to be looked up. While doing the lookup, I retrieve the
> > longname. I add the longname to the dcache, and I set the hash of the
> > string to be the hash of the longname.
> >
> > This does mean that shortname lookups will be slow, but at least they
> > should always give the correct results. Lookups with longnames should
> > be quick.
>
> Hmmm, this makes sense but it isn't quite what I meant, let me adjust what
> I said a bit so it makes more sense. The d_hash element in the dentry
> structure is a linked list. I'd suggest adding in hashes for each actual
> path looked up, so they would all be hashed (and thus cached), even with
> their shortname components; but the all-longname path would be stored in
> the dentry's d_name and the parent directory info, etc. would be based on
> the "canonical" all-longname path. This means that the dentry would not be
> timed out until it stops being accessed by *any* of its paths, but since
> the vast majority of the structure is not replicated this should be OK; it
> just means you might have some rarely used hashes lingering longer than
> they deserve.

With the approach of creating the dentries using only the long names,
there's no need to ever instantiate the short names as a dentry -- they
get used only to find the associated long name. Since the (broken)
concept of having short aliases was only intended to keep old Win 3.1
software working, it will die out over time, so it doesn't really matter
if short-name lookups are less efficient.

Dentries for vfat shouldn't have to be "timed out" -- if the dentries
are managed properly, the use count shows exactly whether the dentry is
still in use. As long as only one dentry is created for each file, the
dcache won't get out of sync with the disk.

Regards,
Bill