*BSD News Article 20257


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!usc!acsc.com!acsc.com!jerry
From: jerry@acsc.com (Jerry Chen)
Newsgroups: comp.os.386bsd.questions
Subject: a cache_lookup() question
Date: 1 Sep 1993 03:59:03 GMT
Organization: Advanced Computing Systems Companync_dvp
Lines: 17
Distribution: world
Message-ID: <2616m7$cpm@acsc.com>
NNTP-Posting-Host: cpuserver.acsc.com

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.

1. When the kernel finds an entry, how can the nc_vp be NULL?  It seems to
me that if nc_vp is NULL (eg, it is purged), then, nc_dvp will also be
NULL, then, the kernel cannot find the entry in the name cache (since
it will compare nc_dvp during the search).  I must be missing something.

2. Why does the kernel move the entry to the end of the LRU chain?  I
think the entry should be moved to the head of the LRU chain since the
name/vnode is no longer valid.

Please enlighten me.  Thanks.

Jerry