Subject: The buffer cache and directory blocks
To: None <>
From: Thor Lancelot Simon <>
List: tech-kern
Date: 01/09/2004 16:01:10
I've been thinking about the current use of the buffer cache for directory
blocks.  It occurs to me that there may be little reason to retain directory
blocks in the cache after reading them in, because their contents are also
cached by the namei cache.  Avoiding this might allow more efficient usage
of a buffer cache of a given size.  

Darren Jewell suggests that a possible problem arises when entries from the
same directory block are read in sequentially; if the block does not remain 
in cache, it will be read in over and over again.  Two approaches seem 

1) Preemptively enter all directory entries from a given block into the
   namei cache when reading the block in; then put the directory block
   immediately on the AGE list for priority reuse.  This is vaguely like
   the ReaddirPlus RPC in NFS (which we do not turn on by default).

2) Track whether all directory entries in a given block have been read
   in.  If so, explicitly move the block to the AGE list.

Both approaches seem somewhat complex.  Comments?

 Thor Lancelot Simon	                            
   But as he knew no bad language, he had called him all the names of common
 objects that he could think of, and had screamed: "You lamp!  You towel!  You
 plate!" and so on.              --Sigmund Freud