Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jul 2002 11:38:30 +0930 (CST)
From:      Richard Sharpe <rsharpe@ns.aus.com>
To:        <freebsd-hackers@freebsd.org>
Subject:   Adding readdir entries to the name cache ...
Message-ID:  <Pine.LNX.4.33.0207051104570.2925-100000@ns.aus.com>

next in thread | raw e-mail | index | archive | help
Hi,

I am interested in hearing opinions on whether or not it is useful to 
preload entries into the name cache that are obtained with 
readdir/getdirentries/getdents.

We recently had a problem of the kernel hanging because we were loading 
entries into the name that were being picked up using 
readdir/getdirentries/getdents. These entries were inserted using 
cache_entry, which seems not to check that the entry is already in the 
cache, it simply inserts it. (Normally, cache_entry is called because a VOP 
routine was told to MAKEENTRY).

Eventually, especially because Samba was running on the system[1], we ran 
out of space in the VFSCACHE, and the system hung.

It seemed to me that one way to fix that would be to check whether an 
entry was in the name cache before trying to load it, however, I wonder at 
the wisdom of trying to do so, and feel that the current situation might 
be more than satisfactory.

The most obvious reason for loading readdir entries is to handle ls -l. 
Since ls has to read the directory enties, which it does with 
getdirentries, and then has to stat the entries, which would cause it to 
do a lookup on the name and then retrieve the vnode/inode, it would seem 
to be a win if we preload the entries in the name cache.

However, ls seems to call lstat in the same order that the files are in 
the directory, and a normal clock approach to directories would yield 
exactly the same result. Further, in the cases that the user did not want 
a -l, we would avoid adding many potentially useless names to the name 
cache and reducing its performance.

[1] Samba, because it has to support the Windows case insensitive file 
system, must do some pretty ugly things :-) When a client asks that a file 
be opened, for example, Samba tries with exactly the case that was 
presented. If that fails, it must do a readdir scan of the directory so it 
can do a case-insensitive match. So, even negative caching does not buy us 
much in the the case of Samba. What would help is a case insensitive 
filesystem.
 
Regards
-----
Richard Sharpe, rsharpe@ns.aus.com, rsharpe@samba.org, 
sharpe@ethereal.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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