Subject: Re: ufs-ism in lookup(9)
To: None <wrstuden@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 03/22/2004 09:43:30
hi,

> > actually, cache_lookup() doesn't return the cached entry
> > if MAKEENTRY is not set.  and ufs code depends on this behaviour.
> > it's what i called ufs-ism.
> 
> Well, given that you have patches to every other file system, it does not 
> seem at ALL ufs-centric. Thus "ufs-ism" is not appropriate.

i guess that all of them are inherited from ufs.

> > > After your change we will always blow the
> > > cache entry away and then do a to-disk lookup.
> > 
> > it's how our lookup(9) and vnode ops works *currently*.
> > ufs needs it, but nfs doesn't.
> 
> While I agree you are correct that that's how the code works now (it is 
> quite twisty in places), it is not at all clear to me that ufs "needs" it. 

ufs needs this because ufs_remove relies upon the info stored in
in-core inode by ufs_lookup is valid.  eg. i_offset.

> It could just be that ufs was coded to behave this way. Given that the 
> fact the cache entry removal code dates from revision 1.1 of vfs_cache.c, 
> we'd need to look at the Berkeley revision histories to see why the code 
> is as it is. Also, given that disk is going to get slower and slower with 
> time (relative to CPUs), I'm more interested in having all of the file 
> systems use the cache.

feel free to do it. :-)
although i think that it doesn't actually improve efficiency for ufs
because ufs_remove needs ufs_lookup equivalent to remove an entry anyway.

> Let's start over. What exactly are you trying to do? You said something
> about NFS doing inefficient lookups. Ok, how is the current code causing 
> that? Let's look at all the different way's to get that.

currently, when you do "rm somefileonnfs",
our nfs client always issues a LOOKUP rpc before a REMOVE rpc even if
the "somefileonnfs" is on the namecache.  it's what i'd like to change.

as i said in the first mail, it could be achieved in nfs code.
however, i think that it's cleaner to push what i called ufs-ism into
ufs-like filesystems themselves.
(and then you can improve ufs-like filesystems, if you want.)

YAMAMOTO Takashi