Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Regen.
details: https://anonhg.NetBSD.org/src/rev/8d6c278d8a1d
branches: trunk
changeset: 354104:8d6c278d8a1d
user: hannken <hannken%NetBSD.org@localhost>
date: Sun Jun 04 08:00:27 2017 +0000
description:
Regen.
diffstat:
sys/kern/vnode_if.c | 484 +++++++++++++++++++------------
sys/rump/include/rump/rumpvnode_if.h | 6 +-
sys/rump/librump/rumpvfs/rumpvnode_if.c | 8 +-
sys/sys/vnode_if.h | 6 +-
4 files changed, 310 insertions(+), 194 deletions(-)
diffs (truncated from 1189 to 300 lines):
diff -r 074316e46302 -r 8d6c278d8a1d sys/kern/vnode_if.c
--- a/sys/kern/vnode_if.c Sun Jun 04 07:59:17 2017 +0000
+++ b/sys/kern/vnode_if.c Sun Jun 04 08:00:27 2017 +0000
@@ -1,13 +1,13 @@
-/* $NetBSD: vnode_if.c,v 1.104 2017/05/26 14:21:54 riastradh Exp $ */
+/* $NetBSD: vnode_if.c,v 1.105 2017/06/04 08:00:27 hannken Exp $ */
/*
* Warning: DO NOT EDIT! This file is automatically generated!
* (Modifications made here may easily be lost!)
*
* Created from the file:
- * NetBSD: vnode_if.src,v 1.75 2017/05/26 14:21:00 riastradh Exp
+ * NetBSD: vnode_if.src,v 1.76 2017/06/04 07:59:17 hannken Exp
* by the script:
- * NetBSD: vnode_if.sh,v 1.64 2017/04/16 17:18:28 riastradh Exp
+ * NetBSD: vnode_if.sh,v 1.65 2017/06/04 07:59:17 hannken Exp
*/
/*
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.104 2017/05/26 14:21:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.105 2017/06/04 08:00:27 hannken Exp $");
#include <sys/param.h>
#include <sys/mount.h>
@@ -49,6 +49,57 @@
#include <sys/lock.h>
#include <sys/fstrans.h>
+enum fst_op { FST_NO, FST_YES, FST_TRY };
+
+static inline int
+vop_pre(vnode_t *vp, struct mount **mp, bool *mpsafe, enum fst_op op)
+{
+ int error;
+
+ *mpsafe = (vp->v_vflag & VV_MPSAFE);
+
+ if (!*mpsafe) {
+ KERNEL_LOCK(1, curlwp);
+ }
+
+ if (op == FST_YES || op == FST_TRY) {
+ for (;;) {
+ *mp = vp->v_mount;
+ if (op == FST_TRY) {
+ error = fstrans_start_nowait(*mp, FSTRANS_SHARED);
+ if (error) {
+ if (!*mpsafe) {
+ KERNEL_UNLOCK_ONE(curlwp);
+ }
+ return error;
+ }
+ } else {
+ fstrans_start(*mp, FSTRANS_SHARED);
+ }
+ if (__predict_true(*mp == vp->v_mount))
+ break;
+ fstrans_done(*mp);
+ }
+ } else {
+ *mp = vp->v_mount;
+ }
+
+ return 0;
+}
+
+static inline void
+vop_post(vnode_t *vp, struct mount *mp, bool mpsafe, enum fst_op op)
+{
+
+ if (op == FST_YES) {
+ fstrans_done(mp);
+ }
+
+ if (!mpsafe) {
+ KERNEL_UNLOCK_ONE(curlwp);
+ }
+}
+
const struct vnodeop_desc vop_default_desc = {
0,
"default",
@@ -80,16 +131,15 @@
int error;
bool mpsafe;
struct vop_bwrite_args a;
- struct mount *mp = vp->v_mount;
+ struct mount *mp;
a.a_desc = VDESC(vop_bwrite);
a.a_vp = vp;
a.a_bp = bp;
- mpsafe = (vp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
- fstrans_start(mp, FSTRANS_SHARED);
+ error = vop_pre(vp, &mp, &mpsafe, FST_YES);
+ if (error)
+ return error;
error = (VCALL(vp, VOFFSET(vop_bwrite), &a));
- fstrans_done(mp);
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(vp, mp, mpsafe, FST_YES);
return error;
}
@@ -114,14 +164,16 @@
int error;
bool mpsafe;
struct vop_lookup_v2_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_lookup);
a.a_dvp = dvp;
a.a_vpp = vpp;
a.a_cnp = cnp;
- mpsafe = (dvp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
+ error = vop_pre(dvp, &mp, &mpsafe, FST_NO);
+ if (error)
+ return error;
error = (VCALL(dvp, VOFFSET(vop_lookup), &a));
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(dvp, mp, mpsafe, FST_NO);
#ifdef DIAGNOSTIC
if (error == 0)
KASSERT((*vpp)->v_size != VSIZENOTSET
@@ -152,15 +204,17 @@
int error;
bool mpsafe;
struct vop_create_v3_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_create);
a.a_dvp = dvp;
a.a_vpp = vpp;
a.a_cnp = cnp;
a.a_vap = vap;
- mpsafe = (dvp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
+ error = vop_pre(dvp, &mp, &mpsafe, FST_NO);
+ if (error)
+ return error;
error = (VCALL(dvp, VOFFSET(vop_create), &a));
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(dvp, mp, mpsafe, FST_NO);
#ifdef DIAGNOSTIC
if (error == 0)
KASSERT((*vpp)->v_size != VSIZENOTSET
@@ -191,15 +245,17 @@
int error;
bool mpsafe;
struct vop_mknod_v3_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_mknod);
a.a_dvp = dvp;
a.a_vpp = vpp;
a.a_cnp = cnp;
a.a_vap = vap;
- mpsafe = (dvp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
+ error = vop_pre(dvp, &mp, &mpsafe, FST_NO);
+ if (error)
+ return error;
error = (VCALL(dvp, VOFFSET(vop_mknod), &a));
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(dvp, mp, mpsafe, FST_NO);
#ifdef DIAGNOSTIC
if (error == 0)
KASSERT((*vpp)->v_size != VSIZENOTSET
@@ -229,14 +285,16 @@
int error;
bool mpsafe;
struct vop_open_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_open);
a.a_vp = vp;
a.a_mode = mode;
a.a_cred = cred;
- mpsafe = (vp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
+ error = vop_pre(vp, &mp, &mpsafe, FST_NO);
+ if (error)
+ return error;
error = (VCALL(vp, VOFFSET(vop_open), &a));
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(vp, mp, mpsafe, FST_NO);
return error;
}
@@ -261,14 +319,16 @@
int error;
bool mpsafe;
struct vop_close_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_close);
a.a_vp = vp;
a.a_fflag = fflag;
a.a_cred = cred;
- mpsafe = (vp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
+ error = vop_pre(vp, &mp, &mpsafe, FST_NO);
+ if (error)
+ return error;
error = (VCALL(vp, VOFFSET(vop_close), &a));
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(vp, mp, mpsafe, FST_NO);
return error;
}
@@ -293,14 +353,16 @@
int error;
bool mpsafe;
struct vop_access_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_access);
a.a_vp = vp;
a.a_mode = mode;
a.a_cred = cred;
- mpsafe = (vp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
+ error = vop_pre(vp, &mp, &mpsafe, FST_NO);
+ if (error)
+ return error;
error = (VCALL(vp, VOFFSET(vop_access), &a));
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(vp, mp, mpsafe, FST_NO);
return error;
}
@@ -325,14 +387,16 @@
int error;
bool mpsafe;
struct vop_getattr_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_getattr);
a.a_vp = vp;
a.a_vap = vap;
a.a_cred = cred;
- mpsafe = (vp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
+ error = vop_pre(vp, &mp, &mpsafe, FST_NO);
+ if (error)
+ return error;
error = (VCALL(vp, VOFFSET(vop_getattr), &a));
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(vp, mp, mpsafe, FST_NO);
return error;
}
@@ -357,14 +421,16 @@
int error;
bool mpsafe;
struct vop_setattr_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_setattr);
a.a_vp = vp;
a.a_vap = vap;
a.a_cred = cred;
- mpsafe = (vp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
+ error = vop_pre(vp, &mp, &mpsafe, FST_NO);
+ if (error)
+ return error;
error = (VCALL(vp, VOFFSET(vop_setattr), &a));
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(vp, mp, mpsafe, FST_NO);
return error;
}
@@ -390,15 +456,17 @@
int error;
bool mpsafe;
struct vop_read_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_read);
a.a_vp = vp;
a.a_uio = uio;
a.a_ioflag = ioflag;
a.a_cred = cred;
- mpsafe = (vp->v_vflag & VV_MPSAFE);
- if (!mpsafe) { KERNEL_LOCK(1, curlwp); }
+ error = vop_pre(vp, &mp, &mpsafe, FST_NO);
+ if (error)
+ return error;
error = (VCALL(vp, VOFFSET(vop_read), &a));
- if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); }
+ vop_post(vp, mp, mpsafe, FST_NO);
return error;
}
@@ -424,15 +492,17 @@
int error;
bool mpsafe;
struct vop_write_args a;
+ struct mount *mp;
a.a_desc = VDESC(vop_write);
a.a_vp = vp;
a.a_uio = uio;
Home |
Main Index |
Thread Index |
Old Index