Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Mar 2019 13:03:46 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Alan Somers <asomers@freebsd.org>
Cc:        FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Adding namecache entries outside of vfs_lookup and vn_open ?
Message-ID:  <20190303110346.GH68879@kib.kiev.ua>
In-Reply-To: <CAOtMX2inYez8dXbmA5b1wj9Uhh_Nbp-gnFmtT_=T1mpWdyAUVw@mail.gmail.com>
References:  <CAOtMX2inYez8dXbmA5b1wj9Uhh_Nbp-gnFmtT_=T1mpWdyAUVw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Mar 02, 2019 at 06:02:06PM -0700, Alan Somers wrote:
> It looks like lookup and open are the only common vops that create new
> namecache entries.  At least, those are the only ones that set
> MAKEENTRY in the cn_flags field.  However, fuse(4)'s create-like
> operations (FUSE_CREATE, FUSE_SYMLINK, etc) all return enough
> information to create a namecache entry for the newly created file.
> As-is, an operation like FUSE_CREATE will almost always be followed up
> by a FUSE_LOOKUP, necessitating an extra round-trip to userland.
In VFS, creation of the new file is done by VOP_CREATE() after negative
VOP_LOOKUP().   VOP_CREATE() returns the new vnode that is installed into
file.  [A flag VN_OPEN_NAMECACHE was added for vn_open_cred() which results
in created name entry insertion into namecache.  It was done to handle
very specific situation in core dump code, which is no longer relevant.
The flag is still there.]

Similar discussion occured some time ago.  I think that the current
selection of the cases where namecache entry is created, is optimized
for the scenario where extracting large tarball does not largely affect
the non-directory elements of the cache.  If you do such extraction,
it is unlikely that you will access most of the files shortly.

> Would it be possible and wise to add these newly created entries to
> the namecache automatically?
Not from VFS, but the policy can be overriden by the filesystem by inserting
the elements into cache from VOPs as it finds suitable.

Does FUSE cache vnodes ?  I would find aggressive caching on the kernel
side somewhat unexpected for it.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190303110346.GH68879>