Move vnode members v_dnclist and v_nclist as vi_dnclist and

vi_nclist to vnode_impl.h.
This commit is contained in:
hannken 2017-01-11 09:04:37 +00:00
parent 2e2dd171b3
commit 2b4a4af133
5 changed files with 21 additions and 31 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: vnode.9,v 1.74 2017/01/02 10:33:28 hannken Exp $
.\" $NetBSD: vnode.9,v 1.75 2017/01/11 09:04:37 hannken Exp $
.\"
.\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 2, 2017
.Dd January 11, 2017
.Dt VNODE 9
.Os
.Sh NAME
@ -174,8 +174,6 @@ struct vnode {
struct buflists v_cleanblkhd; /* clean blocklist head */
struct buflists v_dirtyblkhd; /* dirty blocklist head */
TAILQ_ENTRY(vnode) v_synclist; /* vnodes with dirty bufs */
LIST_HEAD(, namecache) v_dnclist; /* namecaches (children) */
LIST_HEAD(, namecache) v_nclist; /* namecaches (parent) */
union {
struct mount *vu_mountedhere;/* ptr to vfs (VDIR) */
struct socket *vu_socket; /* unix ipc (VSOCK) */
@ -316,15 +314,6 @@ Its value must only be modified at splbio (see
It does not track the number of dirty buffers attached to the
vnode.
.Pp
.Em v_dnclist
and
.Em v_nclist
are used by
.Xr namecache 9
to maintain the list of associated entries so that
.Xr cache_purge 9
can purge them.
.Pp
The link to the file system which owns the vnode is recorded by
.Em v_mount .
See

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_cache.c,v 1.111 2017/01/02 10:33:28 hannken Exp $ */
/* $NetBSD: vfs_cache.c,v 1.112 2017/01/11 09:04:37 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.111 2017/01/02 10:33:28 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.112 2017/01/11 09:04:37 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@ -844,9 +844,9 @@ cache_enter(struct vnode *dvp, struct vnode *vp,
/* Fill in cache info. */
ncp->nc_dvp = dvp;
LIST_INSERT_HEAD(&dvp->v_dnclist, ncp, nc_dvlist);
LIST_INSERT_HEAD(&VNODE_TO_VIMPL(dvp)->vi_dnclist, ncp, nc_dvlist);
if (vp)
LIST_INSERT_HEAD(&vp->v_nclist, ncp, nc_vlist);
LIST_INSERT_HEAD(&VNODE_TO_VIMPL(vp)->vi_nclist, ncp, nc_vlist);
else {
ncp->nc_vlist.le_prev = NULL;
ncp->nc_vlist.le_next = NULL;
@ -1031,8 +1031,8 @@ cache_purge1(struct vnode *vp, const char *name, size_t namelen, int flags)
if (flags & PURGE_PARENTS) {
SDT_PROBE(vfs, namecache, purge, parents, vp, 0, 0, 0, 0);
for (ncp = LIST_FIRST(&vp->v_nclist); ncp != NULL;
ncp = ncnext) {
for (ncp = LIST_FIRST(&VNODE_TO_VIMPL(vp)->vi_nclist);
ncp != NULL; ncp = ncnext) {
ncnext = LIST_NEXT(ncp, nc_vlist);
mutex_enter(&ncp->nc_lock);
cache_invalidate(ncp);
@ -1042,8 +1042,8 @@ cache_purge1(struct vnode *vp, const char *name, size_t namelen, int flags)
}
if (flags & PURGE_CHILDREN) {
SDT_PROBE(vfs, namecache, purge, children, vp, 0, 0, 0, 0);
for (ncp = LIST_FIRST(&vp->v_dnclist); ncp != NULL;
ncp = ncnext) {
for (ncp = LIST_FIRST(&VNODE_TO_VIMPL(vp)->vi_dnclist);
ncp != NULL; ncp = ncnext) {
ncnext = LIST_NEXT(ncp, nc_dvlist);
mutex_enter(&ncp->nc_lock);
cache_invalidate(ncp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_vnode.c,v 1.70 2017/01/05 10:05:11 hannken Exp $ */
/* $NetBSD: vfs_vnode.c,v 1.71 2017/01/11 09:04:37 hannken Exp $ */
/*-
* Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@ -156,7 +156,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.70 2017/01/05 10:05:11 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.71 2017/01/11 09:04:37 hannken Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -1023,12 +1023,12 @@ vcache_alloc(void)
memset(vip, 0, sizeof(*vip));
/* SLIST_INIT(&vip->vi_hash); */
/* LIST_INIT(&vip->vi_nclist); */
/* LIST_INIT(&vip->vi_dnclist); */
vp = VIMPL_TO_VNODE(vip);
uvm_obj_init(&vp->v_uobj, &uvm_vnodeops, true, 0);
cv_init(&vp->v_cv, "vnode");
/* LIST_INIT(&vp->v_nclist); */
/* LIST_INIT(&vp->v_dnclist); */
rw_init(&vp->v_lock);
vp->v_usecount = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnode.h,v 1.268 2017/01/02 10:33:28 hannken Exp $ */
/* $NetBSD: vnode.h,v 1.269 2017/01/11 09:04:37 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -74,7 +74,6 @@
#include <uvm/uvm_object.h> /* XXX */
#include <uvm/uvm_extern.h> /* XXX */
struct namecache;
struct uvm_ractx;
#endif
@ -128,7 +127,6 @@ LIST_HEAD(buflists, buf);
* f vnode_free_list_lock, or vrele_lock for vrele_list
* i v_interlock
* m mntvnode_lock
* n namecache_lock
* s syncer_data_lock
* u locked by underlying filesystem
* v vnode lock
@ -155,8 +153,6 @@ struct vnode {
struct buflists v_cleanblkhd; /* x: clean blocklist head */
struct buflists v_dirtyblkhd; /* x: dirty blocklist head */
TAILQ_ENTRY(vnode) v_synclist; /* s: vnodes with dirty bufs */
LIST_HEAD(, namecache) v_dnclist; /* n: namecaches (children) */
LIST_HEAD(, namecache) v_nclist; /* n: namecaches (parent) */
union {
struct mount *vu_mountedhere;/* v: ptr to vfs (VDIR) */
struct socket *vu_socket; /* v: unix ipc (VSOCK) */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vnode_impl.h,v 1.7 2017/01/05 10:05:11 hannken Exp $ */
/* $NetBSD: vnode_impl.h,v 1.8 2017/01/11 09:04:37 hannken Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@ -34,6 +34,8 @@
#include <sys/vnode.h>
struct namecache;
enum vnode_state {
VS_MARKER, /* Stable, used as marker. Will not change. */
VS_LOADING, /* Intermediate, initialising the fs node. */
@ -59,12 +61,15 @@ struct vcache_key {
* c vcache_lock
* d vdrain_lock
* i v_interlock
* n namecache_lock
*/
struct vnode_impl {
struct vnode vi_vnode;
enum vnode_state vi_state; /* i: current state */
struct vnodelst *vi_lrulisthd; /* d: current lru list head */
TAILQ_ENTRY(vnode_impl) vi_lrulist; /* d: lru list */
LIST_HEAD(, namecache) vi_dnclist; /* n: namecaches (children) */
LIST_HEAD(, namecache) vi_nclist; /* n: namecaches (parent) */
SLIST_ENTRY(vnode_impl) vi_hash; /* c: vnode cache list */
struct vcache_key vi_key; /* c: vnode cache key */
};