Date: Mon, 4 Mar 2019 17:42:12 +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: <20190304154212.GP68879@kib.kiev.ua> In-Reply-To: <CAOtMX2hkwYG_Db4pgb5HdXuMTa7UAS6bQ8pNAhhS45mmJsao3Q@mail.gmail.com> References: <CAOtMX2inYez8dXbmA5b1wj9Uhh_Nbp-gnFmtT_=T1mpWdyAUVw@mail.gmail.com> <20190303110346.GH68879@kib.kiev.ua> <CAOtMX2hkwYG_Db4pgb5HdXuMTa7UAS6bQ8pNAhhS45mmJsao3Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Mar 04, 2019 at 08:24:27AM -0700, Alan Somers wrote: > On Sun, Mar 3, 2019 at 4:03 AM Konstantin Belousov <kostikbel@gmail.com> wrote: > > 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. > > I don't understand this objection. When you extract a tarball full of > non-empty files, don't you still need to open every file to write its > contents, creating a namecache entry for each one? No, you don't. Typically, when archiver parsed the stream and noted that there is a file to create with a content, it - opens the file, and gets the file descriptor returned to usermode. Internally, kernel does (vn_open_cred()) namei() <- this call returns no vnode because the file is non-existent, and does not create negative cache entry, see NOCACHE argument for cn_flags. VOP_CREATE() <- creating the file, again not caching assign the vnode returned, to the file - now the process has the descriptor for writes, but namecache entry is still not installed. - content is written, file is closed.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190304154212.GP68879>