Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Move v_writecount adjustment from revoke to reclaim.
details: https://anonhg.NetBSD.org/src/rev/87cc6ae8533a
branches: trunk
changeset: 353448:87cc6ae8533a
user: hannken <hannken%NetBSD.org@localhost>
date: Sun May 07 08:21:57 2017 +0000
description:
Move v_writecount adjustment from revoke to reclaim.
diffstat:
sys/fs/union/union_vnops.c | 22 +++++++++++++---------
sys/miscfs/genfs/layer_vnops.c | 17 ++++++++---------
2 files changed, 21 insertions(+), 18 deletions(-)
diffs (99 lines):
diff -r d8a1c5e72582 -r 87cc6ae8533a sys/fs/union/union_vnops.c
--- a/sys/fs/union/union_vnops.c Sun May 07 08:21:08 2017 +0000
+++ b/sys/fs/union/union_vnops.c Sun May 07 08:21:57 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: union_vnops.c,v 1.67 2017/04/26 03:02:48 riastradh Exp $ */
+/* $NetBSD: union_vnops.c,v 1.68 2017/05/07 08:22:40 hannken Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.67 2017/04/26 03:02:48 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.68 2017/05/07 08:22:40 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1064,13 +1064,8 @@
} */ *ap = v;
struct vnode *vp = ap->a_vp;
- if (UPPERVP(vp)) {
- mutex_enter(UPPERVP(vp)->v_interlock);
- KASSERT(vp->v_interlock == UPPERVP(vp)->v_interlock);
- UPPERVP(vp)->v_writecount -= vp->v_writecount;
- mutex_exit(UPPERVP(vp)->v_interlock);
+ if (UPPERVP(vp))
VOP_REVOKE(UPPERVP(vp), ap->a_flags);
- }
if (LOWERVP(vp))
VOP_REVOKE(LOWERVP(vp), ap->a_flags);
vgone(vp); /* XXXAD?? */
@@ -1585,8 +1580,17 @@
struct vop_reclaim_args /* {
struct vnode *a_vp;
} */ *ap = v;
+ struct vnode *vp = ap->a_vp;
+ struct vnode *uvp = UPPERVP(vp);
- union_freevp(ap->a_vp);
+ if (uvp != NULL) {
+ mutex_enter(uvp->v_interlock);
+ KASSERT(vp->v_interlock == uvp->v_interlock);
+ uvp->v_writecount -= vp->v_writecount;
+ mutex_exit(uvp->v_interlock);
+ }
+
+ union_freevp(vp);
return (0);
}
diff -r d8a1c5e72582 -r 87cc6ae8533a sys/miscfs/genfs/layer_vnops.c
--- a/sys/miscfs/genfs/layer_vnops.c Sun May 07 08:21:08 2017 +0000
+++ b/sys/miscfs/genfs/layer_vnops.c Sun May 07 08:21:57 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: layer_vnops.c,v 1.63 2017/04/26 03:02:49 riastradh Exp $ */
+/* $NetBSD: layer_vnops.c,v 1.64 2017/05/07 08:21:57 hannken Exp $ */
/*
* Copyright (c) 1999 National Aeronautics & Space Administration
@@ -170,7 +170,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.63 2017/04/26 03:02:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: layer_vnops.c,v 1.64 2017/05/07 08:21:57 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -693,15 +693,8 @@
* We will most likely end up in vclean which uses the v_usecount
* to determine if a vnode is active. Take an extra reference on
* the lower vnode so it will always close and inactivate.
- * Remove our writecount from the lower vnode.
*/
vref(lvp);
-
- mutex_enter(vp->v_interlock);
- KASSERT(vp->v_interlock == lvp->v_interlock);
- lvp->v_writecount -= vp->v_writecount;
- mutex_exit(vp->v_interlock);
-
error = LAYERFS_DO_BYPASS(vp, ap);
vrele(lvp);
@@ -734,6 +727,12 @@
*/
lmp->layerm_rootvp = NULL;
}
+
+ mutex_enter(vp->v_interlock);
+ KASSERT(vp->v_interlock == lowervp->v_interlock);
+ lowervp->v_writecount -= vp->v_writecount;
+ mutex_exit(vp->v_interlock);
+
/* After this assignment, this node will not be re-used. */
xp->layer_lowervp = NULL;
kmem_free(vp->v_data, lmp->layerm_size);
Home |
Main Index |
Thread Index |
Old Index