aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorMatt Macy <mmacy@FreeBSD.org>2018-05-09 18:47:24 +0000
committerMatt Macy <mmacy@FreeBSD.org>2018-05-09 18:47:24 +0000
commitcbd92ce62e92bd17871c9668c2c2bebac3e2ac2e (patch)
tree40c405d5c0a6545e7dfd7beb64dc7e5076f7b644 /sys/fs
parent0272270a8d6fe4e6edb92de3e1711442e5d15766 (diff)
Eliminate the overhead of gratuitous repeated reinitialization of cap_rights
- Add macros to allow preinitialization of cap_rights_t. - Convert most commonly used code paths to use preinitialized cap_rights_t. A 3.6% speedup in fstat was measured with this change. Reported by: mjg Reviewed by: oshogbo Approved by: sbruno MFC after: 1 month
Notes
Notes: svn path=/head/; revision=333425
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/fdescfs/fdesc_vnops.c6
-rw-r--r--sys/fs/fuse/fuse_vfsops.c3
2 files changed, 3 insertions, 6 deletions
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
index 30ce286074b6..7d94ddf17a51 100644
--- a/sys/fs/fdescfs/fdesc_vnops.c
+++ b/sys/fs/fdescfs/fdesc_vnops.c
@@ -286,7 +286,6 @@ fdesc_lookup(struct vop_lookup_args *ap)
struct thread *td = cnp->cn_thread;
struct file *fp;
struct fdesc_get_ino_args arg;
- cap_rights_t rights;
int nlen = cnp->cn_namelen;
u_int fd, fd1;
int error;
@@ -331,7 +330,7 @@ fdesc_lookup(struct vop_lookup_args *ap)
/*
* No rights to check since 'fp' isn't actually used.
*/
- if ((error = fget(td, fd, cap_rights_init(&rights), &fp)) != 0)
+ if ((error = fget(td, fd, &cap_no_rights, &fp)) != 0)
goto bad;
/* Check if we're looking up ourselves. */
@@ -613,7 +612,6 @@ static int
fdesc_readlink(struct vop_readlink_args *va)
{
struct vnode *vp, *vn;
- cap_rights_t rights;
struct thread *td;
struct uio *uio;
struct file *fp;
@@ -631,7 +629,7 @@ fdesc_readlink(struct vop_readlink_args *va)
VOP_UNLOCK(vn, 0);
td = curthread;
- error = fget_cap(td, fd_fd, cap_rights_init(&rights), &fp, NULL);
+ error = fget_cap(td, fd_fd, &cap_no_rights, &fp, NULL);
if (error != 0)
goto out;
diff --git a/sys/fs/fuse/fuse_vfsops.c b/sys/fs/fuse/fuse_vfsops.c
index 700d4450c2e7..0be6185e558e 100644
--- a/sys/fs/fuse/fuse_vfsops.c
+++ b/sys/fs/fuse/fuse_vfsops.c
@@ -222,7 +222,6 @@ fuse_vfsop_mount(struct mount *mp)
struct file *fp, *fptmp;
char *fspec, *subtype;
struct vfsoptlist *opts;
- cap_rights_t rights;
subtype = NULL;
max_read_set = 0;
@@ -292,7 +291,7 @@ fuse_vfsop_mount(struct mount *mp)
FS_DEBUG2G("mntopts 0x%jx\n", (uintmax_t)mntopts);
- err = fget(td, fd, cap_rights_init(&rights, CAP_READ), &fp);
+ err = fget(td, fd, &cap_read_rights, &fp);
if (err != 0) {
FS_DEBUG("invalid or not opened device: data=%p\n", data);
goto out;