aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-07-25 10:32:45 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-07-25 10:32:45 +0000
commit07d2145a17178e9df663c90cc45d249502f7f768 (patch)
treed08893cd15aa34820684cca307763205f290ad6d /sys/sys
parent0379ff6ae30878fcb2fb5de34e8dfe2ba49d0d9d (diff)
downloadsrc-07d2145a17178e9df663c90cc45d249502f7f768.tar.gz
src-07d2145a17178e9df663c90cc45d249502f7f768.zip
vfs: add the infrastructure for lockless lookup
Reviewed by: kib Tested by: pho (in a patchset) Differential Revision: https://reviews.freebsd.org/D25577
Notes
Notes: svn path=/head/; revision=363518
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/filedesc.h1
-rw-r--r--sys/sys/mount.h1
-rw-r--r--sys/sys/vnode.h16
3 files changed, 18 insertions, 0 deletions
diff --git a/sys/sys/filedesc.h b/sys/sys/filedesc.h
index 6954b1d23f45..a99b3b0cb047 100644
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -311,6 +311,7 @@ pwd_set(struct filedesc *fdp, struct pwd *newpwd)
smr_serialized_store(&fdp->fd_pwd, newpwd,
(FILEDESC_XLOCK_ASSERT(fdp), true));
}
+struct pwd *pwd_get_smr(void);
#endif /* _KERNEL */
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 6e1517aac4c6..a3bc0518a7ea 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -420,6 +420,7 @@ void __mnt_vnode_markerfree_lazy(struct vnode **mvp, struct mount *mp);
#define MNTK_TEXT_REFS 0x00008000 /* Keep use ref for text */
#define MNTK_VMSETSIZE_BUG 0x00010000
#define MNTK_UNIONFS 0x00020000 /* A hack for F_ISUNIONSTACK */
+#define MNTK_FPLOOKUP 0x00040000 /* fast path lookup is supported */
#define MNTK_NOASYNC 0x00800000 /* disable async */
#define MNTK_UNMOUNT 0x01000000 /* unmount in progress */
#define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index 7c0a4f568451..8273842a91f5 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -666,6 +666,8 @@ int vn_path_to_global_path(struct thread *td, struct vnode *vp,
int vaccess(enum vtype type, mode_t file_mode, uid_t file_uid,
gid_t file_gid, accmode_t accmode, struct ucred *cred,
int *privused);
+int vaccess_vexec_smr(mode_t file_mode, uid_t file_uid, gid_t file_gid,
+ struct ucred *cred);
int vaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid,
struct acl *aclp, accmode_t accmode, struct ucred *cred,
int *privused);
@@ -682,6 +684,8 @@ int vget(struct vnode *vp, int flags, struct thread *td);
enum vgetstate vget_prep_smr(struct vnode *vp);
enum vgetstate vget_prep(struct vnode *vp);
int vget_finish(struct vnode *vp, int flags, enum vgetstate vs);
+void vget_finish_ref(struct vnode *vp, enum vgetstate vs);
+void vget_abort(struct vnode *vp, enum vgetstate vs);
void vgone(struct vnode *vp);
void vhold(struct vnode *);
void vholdl(struct vnode *);
@@ -865,6 +869,8 @@ void vop_symlink_post(void *a, int rc);
int vop_sigdefer(struct vop_vector *vop, struct vop_generic_args *a);
#ifdef DEBUG_VFS_LOCKS
+void vop_fplookup_vexec_pre(void *a);
+void vop_fplookup_vexec_post(void *a, int rc);
void vop_strategy_pre(void *a);
void vop_lock_pre(void *a);
void vop_lock_post(void *a, int rc);
@@ -872,6 +878,8 @@ void vop_unlock_pre(void *a);
void vop_need_inactive_pre(void *a);
void vop_need_inactive_post(void *a, int rc);
#else
+#define vop_fplookup_vexec_pre(x) do { } while (0)
+#define vop_fplookup_vexec_post(x, y) do { } while (0)
#define vop_strategy_pre(x) do { } while (0)
#define vop_lock_pre(x) do { } while (0)
#define vop_lock_post(x, y) do { } while (0)
@@ -1025,10 +1033,18 @@ int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp);
#define VFS_SMR() vfs_smr
#define vfs_smr_enter() smr_enter(VFS_SMR())
#define vfs_smr_exit() smr_exit(VFS_SMR())
+#define vfs_smr_entered_load(ptr) smr_entered_load((ptr), VFS_SMR())
#define VFS_SMR_ASSERT_ENTERED() SMR_ASSERT_ENTERED(VFS_SMR())
#define VFS_SMR_ASSERT_NOT_ENTERED() SMR_ASSERT_NOT_ENTERED(VFS_SMR())
#define VFS_SMR_ZONE_SET(zone) uma_zone_set_smr((zone), VFS_SMR())
+#define vn_load_v_data_smr(vp) ({ \
+ struct vnode *_vp = (vp); \
+ \
+ VFS_SMR_ASSERT_ENTERED(); \
+ atomic_load_ptr(&(_vp)->v_data); \
+})
+
#endif /* _KERNEL */
#endif /* !_SYS_VNODE_H_ */