Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Move vnode members v_synclist_slot and v_synclist as vi_sync...
details: https://anonhg.NetBSD.org/src/rev/6bcb5c40923a
branches: trunk
changeset: 350409:6bcb5c40923a
user: hannken <hannken%NetBSD.org@localhost>
date: Wed Jan 11 09:06:57 2017 +0000
description:
Move vnode members v_synclist_slot and v_synclist as vi_synclist_slot and
vi_synclist to vnode_impl.h.
diffstat:
share/man/man9/vnode.9 | 7 ++-----
sys/kern/vfs_subr.c | 26 ++++++++++++++------------
sys/sys/vnode.h | 5 +----
sys/sys/vnode_impl.h | 5 ++++-
4 files changed, 21 insertions(+), 22 deletions(-)
diffs (184 lines):
diff -r 88b1696818f1 -r 6bcb5c40923a share/man/man9/vnode.9
--- a/share/man/man9/vnode.9 Wed Jan 11 09:04:37 2017 +0000
+++ b/share/man/man9/vnode.9 Wed Jan 11 09:06:57 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: vnode.9,v 1.75 2017/01/11 09:04:37 hannken Exp $
+.\" $NetBSD: vnode.9,v 1.76 2017/01/11 09:06:57 hannken Exp $
.\"
.\" Copyright (c) 2001, 2005, 2006 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -167,13 +167,11 @@
int v_numoutput; /* # of pending writes */
int v_writecount; /* ref count of writers */
int v_holdcnt; /* page & buffer refs */
- int v_synclist_slot; /* synclist slot index */
struct mount *v_mount; /* ptr to vfs we are in */
int (**v_op)(void *); /* vnode operations vector */
TAILQ_ENTRY(vnode) v_mntvnodes; /* vnodes for mount point */
struct buflists v_cleanblkhd; /* clean blocklist head */
struct buflists v_dirtyblkhd; /* dirty blocklist head */
- TAILQ_ENTRY(vnode) v_synclist; /* vnodes with dirty bufs */
union {
struct mount *vu_mountedhere;/* ptr to vfs (VDIR) */
struct socket *vu_socket; /* unix ipc (VSOCK) */
@@ -483,9 +481,8 @@
.Em v_numoutput ,
.Em v_holdcnt ,
.Em v_dirtyblkhd ,
-.Em v_cleanblkhd ,
and
-.Em v_synclist
+.Em v_cleanblkhd
are modified in interrupt context and must be protected by
.Xr splbio 9
unless it is certain that there is no chance an interrupt handler will
diff -r 88b1696818f1 -r 6bcb5c40923a sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c Wed Jan 11 09:04:37 2017 +0000
+++ b/sys/kern/vfs_subr.c Wed Jan 11 09:06:57 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_subr.c,v 1.454 2017/01/05 10:05:11 hannken Exp $ */
+/* $NetBSD: vfs_subr.c,v 1.455 2017/01/11 09:06:57 hannken Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.454 2017/01/05 10:05:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.455 2017/01/11 09:06:57 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -552,7 +552,7 @@
#define SYNCER_MAXDELAY 32
-typedef TAILQ_HEAD(synclist, vnode) synclist_t;
+typedef TAILQ_HEAD(synclist, vnode_impl) synclist_t;
static void vn_syncer_add1(struct vnode *, int);
static void sysctl_vfs_syncfs_setup(struct sysctllog **);
@@ -624,6 +624,7 @@
vn_syncer_add1(struct vnode *vp, int delayx)
{
synclist_t *slp;
+ vnode_impl_t *vip = VNODE_TO_VIMPL(vp);
KASSERT(mutex_owned(&syncer_data_lock));
@@ -633,17 +634,17 @@
* Note: called from sched_sync(), which will not hold
* interlock, therefore we cannot modify v_iflag here.
*/
- slp = &syncer_workitem_pending[vp->v_synclist_slot];
- TAILQ_REMOVE(slp, vp, v_synclist);
+ slp = &syncer_workitem_pending[vip->vi_synclist_slot];
+ TAILQ_REMOVE(slp, vip, vi_synclist);
} else {
KASSERT(mutex_owned(vp->v_interlock));
vp->v_iflag |= VI_ONWORKLST;
}
- vp->v_synclist_slot = sync_delay_slot(delayx);
+ vip->vi_synclist_slot = sync_delay_slot(delayx);
- slp = &syncer_workitem_pending[vp->v_synclist_slot];
- TAILQ_INSERT_TAIL(slp, vp, v_synclist);
+ slp = &syncer_workitem_pending[vip->vi_synclist_slot];
+ TAILQ_INSERT_TAIL(slp, vip, vi_synclist);
}
void
@@ -664,14 +665,15 @@
vn_syncer_remove_from_worklist(struct vnode *vp)
{
synclist_t *slp;
+ vnode_impl_t *vip = VNODE_TO_VIMPL(vp);
KASSERT(mutex_owned(vp->v_interlock));
mutex_enter(&syncer_data_lock);
if (vp->v_iflag & VI_ONWORKLST) {
vp->v_iflag &= ~VI_ONWORKLST;
- slp = &syncer_workitem_pending[vp->v_synclist_slot];
- TAILQ_REMOVE(slp, vp, v_synclist);
+ slp = &syncer_workitem_pending[vip->vi_synclist_slot];
+ TAILQ_REMOVE(slp, vip, vi_synclist);
}
mutex_exit(&syncer_data_lock);
}
@@ -795,14 +797,14 @@
if (syncer_delayno >= syncer_last)
syncer_delayno = 0;
- while ((vp = TAILQ_FIRST(slp)) != NULL) {
+ while ((vp = VIMPL_TO_VNODE(TAILQ_FIRST(slp))) != NULL) {
synced = lazy_sync_vnode(vp);
/*
* XXX The vnode may have been recycled, in which
* case it may have a new identity.
*/
- if (TAILQ_FIRST(slp) == vp) {
+ if (VIMPL_TO_VNODE(TAILQ_FIRST(slp)) == vp) {
/*
* Put us back on the worklist. The worklist
* routine will remove us from our current
diff -r 88b1696818f1 -r 6bcb5c40923a sys/sys/vnode.h
--- a/sys/sys/vnode.h Wed Jan 11 09:04:37 2017 +0000
+++ b/sys/sys/vnode.h Wed Jan 11 09:06:57 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vnode.h,v 1.269 2017/01/11 09:04:37 hannken Exp $ */
+/* $NetBSD: vnode.h,v 1.270 2017/01/11 09:06:57 hannken Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -127,7 +127,6 @@
* f vnode_free_list_lock, or vrele_lock for vrele_list
* i v_interlock
* m mntvnode_lock
- * s syncer_data_lock
* u locked by underlying filesystem
* v vnode lock
* x v_interlock + bufcache_lock to modify, either to inspect
@@ -146,13 +145,11 @@
int v_numoutput; /* i: # of pending writes */
int v_writecount; /* i: ref count of writers */
int v_holdcnt; /* i: page & buffer refs */
- int v_synclist_slot; /* s: synclist slot index */
struct mount *v_mount; /* v: ptr to vfs we are in */
int (**v_op)(void *); /* :: vnode operations vector */
TAILQ_ENTRY(vnode) v_mntvnodes; /* m: vnodes for mount point */
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 */
union {
struct mount *vu_mountedhere;/* v: ptr to vfs (VDIR) */
struct socket *vu_socket; /* v: unix ipc (VSOCK) */
diff -r 88b1696818f1 -r 6bcb5c40923a sys/sys/vnode_impl.h
--- a/sys/sys/vnode_impl.h Wed Jan 11 09:04:37 2017 +0000
+++ b/sys/sys/vnode_impl.h Wed Jan 11 09:06:57 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vnode_impl.h,v 1.8 2017/01/11 09:04:37 hannken Exp $ */
+/* $NetBSD: vnode_impl.h,v 1.9 2017/01/11 09:06:57 hannken Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -62,6 +62,7 @@
* d vdrain_lock
* i v_interlock
* n namecache_lock
+ * s syncer_data_lock
*/
struct vnode_impl {
struct vnode vi_vnode;
@@ -70,6 +71,8 @@
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) */
+ int vi_synclist_slot; /* s: synclist slot index */
+ TAILQ_ENTRY(vnode_impl) vi_synclist; /* s: vnodes with dirty bufs */
SLIST_ENTRY(vnode_impl) vi_hash; /* c: vnode cache list */
struct vcache_key vi_key; /* c: vnode cache key */
};
Home |
Main Index |
Thread Index |
Old Index