Date: Fri, 14 Dec 2018 03:55:09 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342058 - in head/sys: kern sys Message-ID: <201812140355.wBE3t9aj047804@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Fri Dec 14 03:55:08 2018 New Revision: 342058 URL: https://svnweb.freebsd.org/changeset/base/342058 Log: vfs: mostly depessimize NDINIT_ALL 1) filecaps_init was unnecesarily a function call 2) an asignment at the end was preventing tail calling of cap_rights_init Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_descrip.c head/sys/kern/vfs_lookup.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Fri Dec 14 01:06:34 2018 (r342057) +++ head/sys/kern/kern_descrip.c Fri Dec 14 03:55:08 2018 (r342058) @@ -1465,17 +1465,6 @@ out: } /* - * Initialize filecaps structure. - */ -void -filecaps_init(struct filecaps *fcaps) -{ - - bzero(fcaps, sizeof(*fcaps)); - fcaps->fc_nioctls = -1; -} - -/* * Copy filecaps structure allocating memory for ioctls array if needed. * * The last parameter indicates whether the fdtable is locked. If it is not and Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Fri Dec 14 01:06:34 2018 (r342057) +++ head/sys/kern/vfs_lookup.c Fri Dec 14 03:55:08 2018 (r342058) @@ -1302,12 +1302,12 @@ NDINIT_ALL(struct nameidata *ndp, u_long op, u_long fl ndp->ni_dirp = namep; ndp->ni_dirfd = dirfd; ndp->ni_startdir = startdir; + filecaps_init(&ndp->ni_filecaps); + ndp->ni_cnd.cn_thread = td; if (rightsp != NULL) ndp->ni_rightsneeded = *rightsp; else cap_rights_init(&ndp->ni_rightsneeded); - filecaps_init(&ndp->ni_filecaps); - ndp->ni_cnd.cn_thread = td; } /* Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Fri Dec 14 01:06:34 2018 (r342057) +++ head/sys/sys/filedesc.h Fri Dec 14 03:55:08 2018 (r342058) @@ -154,7 +154,13 @@ enum { struct thread; -void filecaps_init(struct filecaps *fcaps); +static __inline void +filecaps_init(struct filecaps *fcaps) +{ + + bzero(fcaps, sizeof(*fcaps)); + fcaps->fc_nioctls = -1; +} bool filecaps_copy(const struct filecaps *src, struct filecaps *dst, bool locked); void filecaps_move(struct filecaps *src, struct filecaps *dst);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812140355.wBE3t9aj047804>