summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-12-13 06:09:19 +0000
committerkib <kib@FreeBSD.org>2013-12-13 06:09:19 +0000
commitd296e566a2ba3a7ebb3f5635db6c2f01fc76a493 (patch)
tree2ef9858a0a22681d84e80c7dcda0bc4b0f5b38a5
parentc4e5b24a258040ba4bc5343ad1fa02df5af9ccc7 (diff)
downloadFreeBSD-src-d296e566a2ba3a7ebb3f5635db6c2f01fc76a493.zip
FreeBSD-src-d296e566a2ba3a7ebb3f5635db6c2f01fc76a493.tar.gz
MFC r257898:
Change VFS_PROLOGUE() to evaluate the mp once, convert MNTK_SHARED_WRITES and MNTK_EXTENDED_SHARED tests into inline functions.
-rw-r--r--sys/kern/vfs_lookup.c9
-rw-r--r--sys/kern/vfs_vnops.c4
-rw-r--r--sys/sys/mount.h21
3 files changed, 21 insertions, 13 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 0be0463..fbca5d8 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -424,13 +424,8 @@ needs_exclusive_leaf(struct mount *mp, int flags)
* extended shared operations, then use a shared lock for the
* leaf node, otherwise use an exclusive lock.
*/
- if (flags & ISOPEN) {
- if (mp != NULL &&
- (mp->mnt_kern_flag & MNTK_EXTENDED_SHARED))
- return (0);
- else
- return (1);
- }
+ if ((flags & ISOPEN) != 0)
+ return (!MNT_EXTENDED_SHARED(mp));
/*
* Lookup requests outside of open() that specify LOCKSHARED
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 00bd998..b65dfc5 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -360,8 +360,8 @@ vn_close(vp, flags, file_cred, td)
struct mount *mp;
int error, lock_flags;
- if (vp->v_type != VFIFO && !(flags & FWRITE) && vp->v_mount != NULL &&
- vp->v_mount->mnt_kern_flag & MNTK_EXTENDED_SHARED)
+ if (vp->v_type != VFIFO && (flags & FWRITE) == 0 &&
+ MNT_EXTENDED_SHARED(vp->v_mount))
lock_flags = LK_SHARED;
else
lock_flags = LK_EXCLUSIVE;
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 8f94451..6e10be6 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -362,8 +362,19 @@ void __mnt_vnode_markerfree_active(struct vnode **mvp, struct mount *);
#define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */
#define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */
-#define MNT_SHARED_WRITES(mp) (((mp) != NULL) && \
- ((mp)->mnt_kern_flag & MNTK_SHARED_WRITES))
+static inline int
+MNT_SHARED_WRITES(struct mount *mp)
+{
+
+ return (mp != NULL && (mp->mnt_kern_flag & MNTK_SHARED_WRITES) != 0);
+}
+
+static inline int
+MNT_EXTENDED_SHARED(struct mount *mp)
+{
+
+ return (mp != NULL && (mp->mnt_kern_flag & MNTK_EXTENDED_SHARED) != 0);
+}
/*
* Sysctl CTL_VFS definitions.
@@ -636,10 +647,12 @@ struct vfsops {
vfs_statfs_t __vfs_statfs;
#define VFS_PROLOGUE(MP) do { \
+ struct mount *mp__; \
int _enable_stops; \
\
- _enable_stops = ((MP) != NULL && \
- ((MP)->mnt_vfc->vfc_flags & VFCF_SBDRY) && sigdeferstop())
+ mp__ = (MP); \
+ _enable_stops = (mp__ != NULL && \
+ (mp__->mnt_vfc->vfc_flags & VFCF_SBDRY) && sigdeferstop())
#define VFS_EPILOGUE(MP) \
if (_enable_stops) \
OpenPOWER on IntegriCloud