Re: [RFC][PATCH] getname_maybe_null() - the third variant of pathname copy-in

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 18, 2024 at 05:51:58PM +0100, Al Viro wrote:
> On Fri, Oct 18, 2024 at 01:06:12PM +0200, Christian Brauner wrote:
> > > Look: all it takes is the following trick
> > > 	* add const char *pathname to struct nameidata
> > > 	* in __set_nameidata() add
> > >         p->pathname = likely(name) ? name->name : "";
> > > 	* in path_init() replace
> > > 	const char *s = nd->name->name;
> > > with
> > > 	const char *s = nd->pathname;
> > > and we are done.  Oh, and teach putname() to treat NULL as no-op.
> > 
> > I know, that's what I suggested to Linus initially but he NAKed it
> > because he didn't want the extra cycles.
> 
> Extra cycles where?  If anything, I'd expect a too-small-to-measure
> speedup due to dereference shifted from path_init() to __set_nameidata().
> Below is literally all it takes to make filename_lookup() treat NULL
> as empty-string name.
> 
> NOTE: I'm not talking about forcing the pure by-descriptor case through
> the dfd+pathname codepath; not without serious profiling.  But treating

Ah ok, that makes sense. I thought you were talking about that...

> AT_FDCWD + NULL by the delta below and passing NULL struct filename to
> filename_lookup()?

Yes, that's good!




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux