Module Name:    src
Committed By:   hannken
Date:           Wed Jan 11 09:06:57 UTC 2017

Modified Files:
        src/share/man/man9: vnode.9
        src/sys/kern: vfs_subr.c
        src/sys/sys: vnode.h vnode_impl.h

Log Message:
Move vnode members v_synclist_slot and v_synclist as vi_synclist_slot and
vi_synclist to vnode_impl.h.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/share/man/man9/vnode.9
cvs rdiff -u -r1.454 -r1.455 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.269 -r1.270 src/sys/sys/vnode.h
cvs rdiff -u -r1.8 -r1.9 src/sys/sys/vnode_impl.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/vnode.9
diff -u src/share/man/man9/vnode.9:1.75 src/share/man/man9/vnode.9:1.76
--- src/share/man/man9/vnode.9:1.75	Wed Jan 11 09:04:37 2017
+++ src/share/man/man9/vnode.9	Wed Jan 11 09:06:57 2017
@@ -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 @@ struct vnode {
 	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 @@ The members
 .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

Index: src/sys/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.454 src/sys/kern/vfs_subr.c:1.455
--- src/sys/kern/vfs_subr.c:1.454	Thu Jan  5 10:05:11 2017
+++ src/sys/kern/vfs_subr.c	Wed Jan 11 09:06:57 2017
@@ -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 @@ vdevgone(int maj, int minl, int minh, en
 
 #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 @@ static void
 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 @@ vn_syncer_add1(struct vnode *vp, int del
 		 * 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 @@ void
 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 @@ sched_sync(void *arg)
 		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

Index: src/sys/sys/vnode.h
diff -u src/sys/sys/vnode.h:1.269 src/sys/sys/vnode.h:1.270
--- src/sys/sys/vnode.h:1.269	Wed Jan 11 09:04:37 2017
+++ src/sys/sys/vnode.h	Wed Jan 11 09:06:57 2017
@@ -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 @@ LIST_HEAD(buflists, buf);
  *	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 @@ struct vnode {
 	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) */

Index: src/sys/sys/vnode_impl.h
diff -u src/sys/sys/vnode_impl.h:1.8 src/sys/sys/vnode_impl.h:1.9
--- src/sys/sys/vnode_impl.h:1.8	Wed Jan 11 09:04:37 2017
+++ src/sys/sys/vnode_impl.h	Wed Jan 11 09:06:57 2017
@@ -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 @@ struct vcache_key {
  *	d	vdrain_lock
  *	i	v_interlock
  *	n	namecache_lock
+ *	s	syncer_data_lock
  */
 struct vnode_impl {
 	struct vnode vi_vnode;
@@ -70,6 +71,8 @@ struct vnode_impl {
 	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 */
 };

Reply via email to