*BSD News Article 20270


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!haven.umd.edu!darwin.sura.net!newsserver.jvnc.net!yale.edu!xlink.net!subnet.sub.net!flatlin!bad
From: bad@flatlin.ka.sub.org (Christoph Badura)
Subject: Re: a cache_lookup() question
Organization: Guru Systems/Funware Department
Date: Wed, 1 Sep 1993 23:54:18 GMT
Message-ID: <CCp92J.Fvy@flatlin.ka.sub.org>
References: <2616m7$cpm@acsc.com>
Lines: 16

In <2616m7$cpm@acsc.com> jerry@acsc.com (Jerry Chen) writes:

>I am reading the ufs source code to learn the file system.  Here is yet
>another question.  When the kernel finds an entry in the name cache,
>and nc_vp is NULL and it is not creating an entry, then it will move
>the entry to the end of the LRU chain.  Why?  I do not understand.

You've just stumbled over the code that handles the case when a file
is known *not* to exist in a directory.  That is an important
optimisation as it allows the code not to scan the whole directory to
see whether a file exists or not.
-- 
    Christoph Badura  ---  bad@flatlin.ka.sub.org  ---  +49 721 606137

Personally, I don't care whether someone is cool enough to quote Doug
Gwyn--I only care whether Doug Gwyn is cool enough to quote. -- Larry Wall