Index: sys/sys/fstypes.h =================================================================== RCS file: /cvsroot/src/sys/sys/fstypes.h,v retrieving revision 1.32 diff -p -u -4 -r1.32 fstypes.h --- sys/sys/fstypes.h 26 Nov 2012 16:22:21 -0000 1.32 +++ sys/sys/fstypes.h 1 May 2015 07:56:18 -0000 @@ -219,8 +219,9 @@ typedef struct fhandle fhandle_t; #define IMNT_DTYPE 0x00000040 /* returns d_type fields */ #define IMNT_HAS_TRANS 0x00000080 /* supports transactions */ #define IMNT_MPSAFE 0x00000100 /* file system code MP safe */ #define IMNT_CAN_RWTORO 0x00000200 /* can downgrade fs to from rw to r/o */ +#define IMNT_ONWORKLIST 0x00000400 /* on syncer worklist */ #define __MNT_FLAGS \ __MNT_BASIC_FLAGS \ __MNT_EXPORTED_FLAGS \ @@ -263,8 +264,9 @@ typedef struct fhandle fhandle_t; "\01MNT_RDONLY" #define __IMNT_FLAG_BITS \ "\20" \ + "\13IMNT_ONWORKLIST" \ "\12IMNT_CAN_RWTORO" \ "\11IMNT_MPSAFE" \ "\10IMNT_HAS_TRANS" \ "\07IMNT_DTYPE" \ Index: sys/sys/mount.h =================================================================== RCS file: /cvsroot/src/sys/sys/mount.h,v retrieving revision 1.216 diff -p -u -4 -r1.216 mount.h --- sys/sys/mount.h 17 Mar 2015 09:38:21 -0000 1.216 +++ sys/sys/mount.h 1 May 2015 07:56:18 -0000 @@ -111,9 +111,9 @@ struct mount { TAILQ_ENTRY(mount) mnt_list; /* mount list */ TAILQ_HEAD(, vnode) mnt_vnodelist; /* list of vnodes this mount */ struct vfsops *mnt_op; /* operations on fs */ struct vnode *mnt_vnodecovered; /* vnode we mounted on */ - struct vnode *mnt_syncer; /* syncer vnode */ + int mnt_synclist_slot; /* synclist slot index */ void *mnt_transinfo; /* for FS-internal use */ void *mnt_data; /* private data */ kmutex_t mnt_unmounting; /* to prevent new activity */ kmutex_t mnt_renamelock; /* per-fs rename lock */ @@ -453,8 +453,18 @@ void vfs_vnode_iterator_init(struct moun void vfs_vnode_iterator_destroy(struct vnode_iterator *); struct vnode *vfs_vnode_iterator_next(struct vnode_iterator *, bool (*)(void *, struct vnode *), void *); +/* Syncer */ +extern int syncer_maxdelay; +extern kmutex_t syncer_mutex; +extern time_t syncdelay; +extern time_t filedelay; +extern time_t dirdelay; +extern time_t metadelay; +void vfs_syncer_add_to_worklist(struct mount *); +void vfs_syncer_remove_from_worklist(struct mount *); + extern TAILQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */ extern struct vfsops *vfssw[]; /* filesystem type table */ extern int nvfssw; extern kmutex_t mountlist_lock; Index: sys/kern/vfs_subr.c =================================================================== RCS file: /cvsroot/src/sys/kern/vfs_subr.c,v retrieving revision 1.445 diff -p -u -4 -r1.445 vfs_subr.c --- sys/kern/vfs_subr.c 5 Sep 2014 05:57:21 -0000 1.445 +++ sys/kern/vfs_subr.c 1 May 2015 07:56:12 -0000 @@ -5,9 +5,10 @@ * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, - * NASA Ames Research Center, by Charles M. Hannum, and by Andrew Doran. + * NASA Ames Research Center, by Charles M. Hannum, by Andrew Doran, + * by Marshall Kirk McKusick and Greg Ganger at the University of Michigan. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -91,9 +92,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v #include #include #include -#include #include #include const enum vtype iftovt_tab[16] = { @@ -121,8 +121,9 @@ int prtactive = 0; /* 1 => print out re * Local declarations. */ static int getdevvp(dev_t, vnode_t **, enum vtype); +static void vn_initialize_syncerd(void); /* * Initialize the vnode management data structures. */ @@ -537,8 +538,375 @@ vdevgone(int maj, int minl, int minh, en } } /* + * The filesystem synchronizer mechanism - syncer. + * + * It is useful to delay writes of file data and filesystem metadata for + * a certain amount of time so that quickly created and deleted files need + * not waste disk bandwidth being created and removed. To implement this, + * vnodes are appended to a "workitem" queue. + * + * Most pending metadata should not wait for more than ten seconds. Thus, + * mounted on block devices are delayed only about a half the time that file + * data is delayed. Similarly, directory updates are more critical, so are + * only delayed about a third the time that file data is delayed. + * + * There are SYNCER_MAXDELAY queues that are processed in a round-robin + * manner at a rate of one each second (driven off the filesystem syner + * thread). The syncer_delayno variable indicates the next queue that is + * to be processed. Items that need to be processed soon are placed in + * this queue: + * + * syncer_workitem_pending[syncer_delayno] + * + * A delay of e.g. fifteen seconds is done by placing the request fifteen + * entries later in the queue: + * + * syncer_workitem_pending[(syncer_delayno + 15) & syncer_mask] + * + * Flag VI_ONWORKLST indicates that vnode is added into the queue. + */ + +#define SYNCER_MAXDELAY 32 + +typedef TAILQ_HEAD(synclist, vnode) synclist_t; + +static void vn_syncer_add1(struct vnode *, int); +static void sysctl_vfs_syncfs_setup(struct sysctllog **); + +/* + * Defines and variables for the syncer process. + */ +int syncer_maxdelay = SYNCER_MAXDELAY; /* maximum delay time */ +time_t syncdelay = 30; /* max time to delay syncing data */ +time_t filedelay = 30; /* time to delay syncing files */ +time_t dirdelay = 15; /* time to delay syncing directories */ +time_t metadelay = 10; /* time to delay syncing metadata */ +time_t lockdelay = 1; /* time to delay if locking fails */ + +kmutex_t syncer_mutex; /* used to freeze syncer, long term */ +static kmutex_t syncer_data_lock; /* short term lock on data structs */ + +static int syncer_delayno = 0; +static long syncer_last; +static synclist_t * syncer_workitem_pending; + +static void +vn_initialize_syncerd(void) +{ + int i; + + syncer_last = SYNCER_MAXDELAY + 2; + + sysctl_vfs_syncfs_setup(NULL); + + syncer_workitem_pending = + kmem_alloc(syncer_last * sizeof (struct synclist), KM_SLEEP); + + for (i = 0; i < syncer_last; i++) + TAILQ_INIT(&syncer_workitem_pending[i]); + + mutex_init(&syncer_mutex, MUTEX_DEFAULT, IPL_NONE); + mutex_init(&syncer_data_lock, MUTEX_DEFAULT, IPL_NONE); +} + +/* + * Return delay factor appropriate for the given file system. For + * WAPBL we use the sync vnode to burst out metadata updates: sync + * those file systems more frequently. + */ +static inline int +sync_delay(struct mount *mp) +{ + + return mp->mnt_wapbl != NULL ? metadelay : syncdelay; +} + +/* + * Compute the next slot index from delay. + */ +static inline int +sync_delay_slot(int delayx) +{ + + if (delayx > syncer_maxdelay - 2) + delayx = syncer_maxdelay - 2; + return (syncer_delayno + delayx) % syncer_last; +} + +/* + * Add an item to the syncer work queue. + */ +static void +vn_syncer_add1(struct vnode *vp, int delayx) +{ + synclist_t *slp; + + KASSERT(mutex_owned(&syncer_data_lock)); + + if (vp->v_iflag & VI_ONWORKLST) { + /* + * Remove in order to adjust the position of the vnode. + * 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); + } else { + KASSERT(mutex_owned(vp->v_interlock)); + vp->v_iflag |= VI_ONWORKLST; + } + + vp->v_synclist_slot = sync_delay_slot(delayx); + + slp = &syncer_workitem_pending[vp->v_synclist_slot]; + TAILQ_INSERT_TAIL(slp, vp, v_synclist); +} + +void +vn_syncer_add_to_worklist(struct vnode *vp, int delayx) +{ + + KASSERT(mutex_owned(vp->v_interlock)); + + mutex_enter(&syncer_data_lock); + vn_syncer_add1(vp, delayx); + mutex_exit(&syncer_data_lock); +} + +/* + * Remove an item from the syncer work queue. + */ +void +vn_syncer_remove_from_worklist(struct vnode *vp) +{ + synclist_t *slp; + + 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); + } + mutex_exit(&syncer_data_lock); +} + +/* + * Add this mount point to the syncer. + */ +void +vfs_syncer_add_to_worklist(struct mount *mp) +{ + static int start, incr, next; + int vdelay; + + KASSERT(mutex_owned(&mp->mnt_updating)); + KASSERT((mp->mnt_iflag & IMNT_ONWORKLIST) == 0); + + /* + * We attempt to scatter the mount points on the list + * so that they will go off at evenly distributed times + * even if all the filesystems are mounted at once. + */ + + next += incr; + if (next == 0 || next > syncer_maxdelay) { + start /= 2; + incr /= 2; + if (start == 0) { + start = syncer_maxdelay / 2; + incr = syncer_maxdelay; + } + next = start; + } + mp->mnt_iflag |= IMNT_ONWORKLIST; + vdelay = sync_delay(mp); + mp->mnt_synclist_slot = vdelay > 0 ? next % vdelay : 0; +} + +/* + * Remove the mount point from the syncer. + */ +void +vfs_syncer_remove_from_worklist(struct mount *mp) +{ + + KASSERT(mutex_owned(&mp->mnt_updating)); + KASSERT((mp->mnt_iflag & IMNT_ONWORKLIST) != 0); + + mp->mnt_iflag &= ~IMNT_ONWORKLIST; +} + +/* + * Try lazy sync, return true on success. + */ +static bool +lazy_sync_vnode(struct vnode *vp) +{ + bool synced; + + KASSERT(mutex_owned(&syncer_data_lock)); + + synced = false; + /* We are locking in the wrong direction. */ + if (mutex_tryenter(vp->v_interlock)) { + mutex_exit(&syncer_data_lock); + if (vget(vp, LK_NOWAIT, false /* !wait */) == 0) { + if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT) == 0) { + synced = true; + (void) VOP_FSYNC(vp, curlwp->l_cred, + FSYNC_LAZY, 0, 0); + vput(vp); + } else + vrele(vp); + } + mutex_enter(&syncer_data_lock); + } + return synced; +} + +/* + * System filesystem synchronizer daemon. + */ +void +sched_sync(void *arg) +{ + synclist_t *slp; + struct vnode *vp; + struct mount *mp, *nmp; + time_t starttime; + bool synced; + + for (;;) { + mutex_enter(&syncer_mutex); + + starttime = time_second; + + /* + * Sync mounts whose dirty time has expired. + */ + mutex_enter(&mountlist_lock); + for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) { + if ((mp->mnt_iflag & IMNT_ONWORKLIST) == 0 || + mp->mnt_synclist_slot != syncer_delayno) { + nmp = TAILQ_NEXT(mp, mnt_list); + continue; + } + mp->mnt_synclist_slot = sync_delay_slot(sync_delay(mp)); + if (vfs_busy(mp, &nmp)) + continue; + VFS_SYNC(mp, MNT_LAZY, curlwp->l_cred); + vfs_unbusy(mp, false, &nmp); + } + mutex_exit(&mountlist_lock); + + mutex_enter(&syncer_data_lock); + + /* + * Push files whose dirty time has expired. + */ + slp = &syncer_workitem_pending[syncer_delayno]; + syncer_delayno += 1; + if (syncer_delayno >= syncer_last) + syncer_delayno = 0; + + while ((vp = 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) { + /* + * Put us back on the worklist. The worklist + * routine will remove us from our current + * position and then add us back in at a later + * position. + * + * Try again sooner rather than later if + * we were unable to lock the vnode. Lock + * failure should not prevent us from doing + * the sync "soon". + * + * If we locked it yet arrive here, it's + * likely that lazy sync is in progress and + * so the vnode still has dirty metadata. + * syncdelay is mainly to get this vnode out + * of the way so we do not consider it again + * "soon" in this loop, so the delay time is + * not critical as long as it is not "soon". + * While write-back strategy is the file + * system's domain, we expect write-back to + * occur no later than syncdelay seconds + * into the future. + */ + vn_syncer_add1(vp, + synced ? syncdelay : lockdelay); + } + } + mutex_exit(&syncer_mutex); + + /* + * If it has taken us less than a second to process the + * current work, then wait. Otherwise start right over + * again. We can still lose time if any single round + * takes more than two seconds, but it does not really + * matter as we are just trying to generally pace the + * filesystem activity. + */ + if (time_second == starttime) { + kpause("syncer", false, hz, &syncer_data_lock); + } + mutex_exit(&syncer_data_lock); + } +} + +static void +sysctl_vfs_syncfs_setup(struct sysctllog **clog) +{ + const struct sysctlnode *rnode, *cnode; + + sysctl_createv(clog, 0, NULL, &rnode, + CTLFLAG_PERMANENT, + CTLTYPE_NODE, "sync", + SYSCTL_DESCR("syncer options"), + NULL, 0, NULL, 0, + CTL_VFS, CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, &rnode, &cnode, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_QUAD, "delay", + SYSCTL_DESCR("max time to delay syncing data"), + NULL, 0, &syncdelay, 0, + CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, &rnode, &cnode, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_QUAD, "filedelay", + SYSCTL_DESCR("time to delay syncing files"), + NULL, 0, &filedelay, 0, + CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, &rnode, &cnode, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_QUAD, "dirdelay", + SYSCTL_DESCR("time to delay syncing directories"), + NULL, 0, &dirdelay, 0, + CTL_CREATE, CTL_EOL); + + sysctl_createv(clog, 0, &rnode, &cnode, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, + CTLTYPE_QUAD, "metadelay", + SYSCTL_DESCR("time to delay syncing metadata"), + NULL, 0, &metadelay, 0, + CTL_CREATE, CTL_EOL); +} + +/* * sysctl helper routine to return list of supported fstypes */ int sysctl_vfs_generic_fstypes(SYSCTLFN_ARGS) @@ -1151,10 +1519,10 @@ void vfs_mount_print(struct mount *mp, int full, void (*pr)(const char *, ...)) { char sbuf[256]; - (*pr)("vnodecovered = %p syncer = %p data = %p\n", - mp->mnt_vnodecovered,mp->mnt_syncer,mp->mnt_data); + (*pr)("vnodecovered = %p data = %p\n", + mp->mnt_vnodecovered,mp->mnt_data); (*pr)("fs_bshift %d dev_bshift = %d\n", mp->mnt_fs_bshift,mp->mnt_dev_bshift); Index: distrib/sets/lists/base/mi =================================================================== RCS file: /cvsroot/src/distrib/sets/lists/base/mi,v retrieving revision 1.1101 diff -p -u -4 -r1.1101 mi --- distrib/sets/lists/base/mi 21 Apr 2015 22:41:32 -0000 1.1101 +++ distrib/sets/lists/base/mi 1 May 2015 07:54:09 -0000 @@ -979,9 +979,9 @@ ./usr/include/miscfs/portal base-obsolete obsolete ./usr/include/miscfs/procfs base-c-usr ./usr/include/miscfs/ptyfs base-obsolete obsolete ./usr/include/miscfs/specfs base-c-usr -./usr/include/miscfs/syncfs base-c-usr +./usr/include/miscfs/syncfs base-obsolete obsolete ./usr/include/miscfs/umapfs base-c-usr ./usr/include/miscfs/union base-c-usr ./usr/include/msdosfs base-c-usr ./usr/include/net base-c-usr Index: distrib/sets/lists/comp/mi =================================================================== RCS file: /cvsroot/src/distrib/sets/lists/comp/mi,v retrieving revision 1.1954 diff -p -u -4 -r1.1954 mi --- distrib/sets/lists/comp/mi 21 Apr 2015 11:10:29 -0000 1.1954 +++ distrib/sets/lists/comp/mi 1 May 2015 07:54:10 -0000 @@ -2528,9 +2528,9 @@ ./usr/include/miscfs/overlay/overlay.h comp-c-include ./usr/include/miscfs/portal/portal.h comp-obsolete obsolete ./usr/include/miscfs/procfs/procfs.h comp-c-include ./usr/include/miscfs/specfs/specdev.h comp-c-include -./usr/include/miscfs/syncfs/syncfs.h comp-c-include +./usr/include/miscfs/syncfs/syncfs.h comp-obsolete obsolete ./usr/include/miscfs/umapfs/umap.h comp-c-include ./usr/include/miscfs/union/union.h comp-c-include ./usr/include/mj.h comp-c-include crypto ./usr/include/mntopts.h comp-c-include Index: external/cddl/osnet/sys/kern/vfs.c =================================================================== RCS file: /cvsroot/src/external/cddl/osnet/sys/kern/vfs.c,v retrieving revision 1.5 diff -p -u -4 -r1.5 vfs.c --- external/cddl/osnet/sys/kern/vfs.c 25 Nov 2013 22:48:05 -0000 1.5 +++ external/cddl/osnet/sys/kern/vfs.c 1 May 2015 07:55:08 -0000 @@ -331,9 +331,9 @@ domount(kthread_t *td, vnode_t *vp, cons mountcheckdirs(vp, mvp); vput(mvp); VOP_UNLOCK(vp); if ((mp->mnt_flag & MNT_RDONLY) == 0) - error = vfs_allocate_syncvnode(mp); + vfs_syncer_add_to_worklist(mp); vfs_unbusy(mp, td); if (error) vrele(vp); else Index: sys/coda/coda_psdev.c =================================================================== RCS file: /cvsroot/src/sys/coda/coda_psdev.c,v retrieving revision 1.54 diff -p -u -4 -r1.54 coda_psdev.c --- sys/coda/coda_psdev.c 13 Dec 2014 15:58:39 -0000 1.54 +++ sys/coda/coda_psdev.c 1 May 2015 07:56:06 -0000 @@ -71,10 +71,8 @@ extern int coda_nc_initialized; /* Se #include #include #include -#include - #include #include #include #include Index: sys/fs/puffs/puffs_msgif.c =================================================================== RCS file: /cvsroot/src/sys/fs/puffs/puffs_msgif.c,v retrieving revision 1.97 diff -p -u -4 -r1.97 puffs_msgif.c --- sys/fs/puffs/puffs_msgif.c 10 Nov 2014 18:46:33 -0000 1.97 +++ sys/fs/puffs/puffs_msgif.c 1 May 2015 07:56:12 -0000 @@ -50,10 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: puffs_msgif. #include #include -#include /* XXX: for syncer_mutex reference */ - /* * waitq data structures */ Index: sys/kern/files.kern =================================================================== RCS file: /cvsroot/src/sys/kern/files.kern,v retrieving revision 1.3 diff -p -u -4 -r1.3 files.kern --- sys/kern/files.kern 7 Mar 2015 16:35:37 -0000 1.3 +++ sys/kern/files.kern 1 May 2015 07:56:12 -0000 @@ -225,6 +225,4 @@ file miscfs/genfs/layer_subr.c layerfs file miscfs/genfs/layer_vfsops.c layerfs file miscfs/genfs/layer_vnops.c layerfs file miscfs/specfs/spec_vnops.c vfs -file miscfs/syncfs/sync_subr.c vfs -file miscfs/syncfs/sync_vnops.c vfs Index: sys/kern/init_main.c =================================================================== RCS file: /cvsroot/src/sys/kern/init_main.c,v retrieving revision 1.463 diff -p -u -4 -r1.463 init_main.c --- sys/kern/init_main.c 23 Apr 2015 23:23:08 -0000 1.463 +++ sys/kern/init_main.c 1 May 2015 07:56:12 -0000 @@ -210,9 +210,8 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c, #include #include -#include #include #include Index: sys/kern/vfs_init.c =================================================================== RCS file: /cvsroot/src/sys/kern/vfs_init.c,v retrieving revision 1.47 diff -p -u -4 -r1.47 vfs_init.c --- sys/kern/vfs_init.c 25 Feb 2014 18:30:11 -0000 1.47 +++ sys/kern/vfs_init.c 1 May 2015 07:56:12 -0000 @@ -106,15 +106,13 @@ extern const struct vnodeop_desc * const */ extern const struct vnodeopv_desc dead_vnodeop_opv_desc; extern const struct vnodeopv_desc fifo_vnodeop_opv_desc; extern const struct vnodeopv_desc spec_vnodeop_opv_desc; -extern const struct vnodeopv_desc sync_vnodeop_opv_desc; const struct vnodeopv_desc * const vfs_special_vnodeopv_descs[] = { &dead_vnodeop_opv_desc, &fifo_vnodeop_opv_desc, &spec_vnodeop_opv_desc, - &sync_vnodeop_opv_desc, NULL, }; struct vfs_list_head vfs_list = /* vfs list */ Index: sys/kern/vfs_mount.c =================================================================== RCS file: /cvsroot/src/sys/kern/vfs_mount.c,v retrieving revision 1.34 diff -p -u -4 -r1.34 vfs_mount.c --- sys/kern/vfs_mount.c 20 Apr 2015 13:44:16 -0000 1.34 +++ sys/kern/vfs_mount.c 1 May 2015 07:56:12 -0000 @@ -92,9 +92,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_mount.c, #include #include #include -#include #include /* Root filesystem. */ vnode_t * rootvnode; @@ -721,9 +720,9 @@ mount_domount(struct lwp *l, vnode_t **v mutex_enter(&mountlist_lock); TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); mutex_exit(&mountlist_lock); if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0) - error = vfs_allocate_syncvnode(mp); + vfs_syncer_add_to_worklist(mp); if (error == 0) vp->v_mountedhere = mp; vput(nd.ni_vp); if (error != 0) @@ -807,9 +806,9 @@ dounmount(struct mount *mp, int flags, s mutex_exit(&syncer_mutex); return ENOENT; } - used_syncer = (mp->mnt_syncer != NULL); + used_syncer = (mp->mnt_iflag & IMNT_ONWORKLIST) != 0; used_extattr = mp->mnt_flag & MNT_EXTATTR; /* * XXX Syncer must be frozen when we get here. This should really @@ -830,10 +829,10 @@ dounmount(struct mount *mp, int flags, s mutex_enter(&mp->mnt_updating); async = mp->mnt_flag & MNT_ASYNC; mp->mnt_flag &= ~MNT_ASYNC; cache_purgevfs(mp); /* remove cache entries for this file sys */ - if (mp->mnt_syncer != NULL) - vfs_deallocate_syncvnode(mp); + if (used_syncer) + vfs_syncer_remove_from_worklist(mp); error = 0; if ((mp->mnt_flag & MNT_RDONLY) == 0) { error = VFS_SYNC(mp, MNT_WAIT, l->l_cred); } @@ -843,9 +842,9 @@ dounmount(struct mount *mp, int flags, s if (error) { mp->mnt_iflag &= ~IMNT_UNMOUNT; mutex_exit(&mp->mnt_unmounting); if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0) - (void) vfs_allocate_syncvnode(mp); + vfs_syncer_add_to_worklist(mp); mp->mnt_flag |= async; mutex_exit(&mp->mnt_updating); if (used_syncer) mutex_exit(&syncer_mutex); Index: sys/kern/vfs_syscalls.c =================================================================== RCS file: /cvsroot/src/sys/kern/vfs_syscalls.c,v retrieving revision 1.497 diff -p -u -4 -r1.497 vfs_syscalls.c --- sys/kern/vfs_syscalls.c 21 Apr 2015 03:19:03 -0000 1.497 +++ sys/kern/vfs_syscalls.c 1 May 2015 07:56:12 -0000 @@ -107,9 +107,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls #include #include #include -#include #include #include #include @@ -327,13 +326,13 @@ mount_update(struct lwp *l, struct vnode mp->mnt_flag = saved_flags; mp->mnt_flag &= ~MNT_OP_FLAGS; mp->mnt_iflag &= ~IMNT_WANTRDWR; if ((mp->mnt_flag & (MNT_RDONLY | MNT_ASYNC)) == 0) { - if (mp->mnt_syncer == NULL) - error = vfs_allocate_syncvnode(mp); + if ((mp->mnt_iflag & IMNT_ONWORKLIST) == 0) + vfs_syncer_add_to_worklist(mp); } else { - if (mp->mnt_syncer != NULL) - vfs_deallocate_syncvnode(mp); + if ((mp->mnt_iflag & IMNT_ONWORKLIST) != 0) + vfs_syncer_remove_from_worklist(mp); } mutex_exit(&mp->mnt_updating); vfs_unbusy(mp, false, NULL); Index: sys/kern/vfs_trans.c =================================================================== RCS file: /cvsroot/src/sys/kern/vfs_trans.c,v retrieving revision 1.32 diff -p -u -4 -r1.32 vfs_trans.c --- sys/kern/vfs_trans.c 21 Apr 2015 10:54:52 -0000 1.32 +++ sys/kern/vfs_trans.c 1 May 2015 07:56:12 -0000 @@ -50,9 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_trans.c, #include #include #include -#include struct fscow_handler { LIST_ENTRY(fscow_handler) ch_list; int (*ch_func)(void *, struct buf *, bool); Index: sys/miscfs/Makefile =================================================================== RCS file: /cvsroot/src/sys/miscfs/Makefile,v retrieving revision 1.9 diff -p -u -4 -r1.9 Makefile --- sys/miscfs/Makefile 5 Dec 2009 20:11:17 -0000 1.9 +++ sys/miscfs/Makefile 1 May 2015 07:56:13 -0000 @@ -1,8 +1,7 @@ # $NetBSD: Makefile,v 1.9 2009/12/05 20:11:17 pooka Exp $ -SUBDIR= fdesc fifofs genfs kernfs nullfs overlay -SUBDIR+= procfs specfs syncfs umapfs +SUBDIR= fdesc fifofs genfs kernfs nullfs overlay procfs specfs umapfs INCSDIR= /usr/include/miscfs .include Index: sys/miscfs/genfs/genfs_io.c =================================================================== RCS file: /cvsroot/src/sys/miscfs/genfs/genfs_io.c,v retrieving revision 1.60 diff -p -u -4 -r1.60 genfs_io.c --- sys/miscfs/genfs/genfs_io.c 12 Apr 2015 14:44:06 -0000 1.60 +++ sys/miscfs/genfs/genfs_io.c 1 May 2015 07:56:13 -0000 @@ -46,9 +46,8 @@ __KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v #include #include #include -#include #include #include Index: sys/rump/librump/rumpvfs/Makefile.rumpvfs =================================================================== RCS file: /cvsroot/src/sys/rump/librump/rumpvfs/Makefile.rumpvfs,v retrieving revision 1.46 diff -p -u -4 -r1.46 Makefile.rumpvfs --- sys/rump/librump/rumpvfs/Makefile.rumpvfs 23 Apr 2015 14:49:26 -0000 1.46 +++ sys/rump/librump/rumpvfs/Makefile.rumpvfs 1 May 2015 07:56:17 -0000 @@ -10,9 +10,9 @@ LIB= rumpvfs MAN= rump_etfs.3 rumpfs.4 .PATH: ${RUMPTOP}/librump/rumpvfs ${RUMPTOP}/librump \ ${RUMPTOP}/../kern \ - ${RUMPTOP}/../miscfs/genfs ${RUMPTOP}/../miscfs/syncfs \ + ${RUMPTOP}/../miscfs/genfs \ ${RUMPTOP}/../miscfs/specfs ${RUMPTOP}/../miscfs/deadfs \ ${RUMPTOP}/../compat/common ${RUMPTOP}/../uvm \ ${RUMPTOP}/../dev ${RUMPTOP}/../ufs/mfs \ ${RUMPTOP}/../dev ${RUMPTOP}/../ufs/ufs @@ -40,11 +40,8 @@ SRCS+= kern_module_vfs.c subr_kobj_vfs.c # sys/uvm SRCS+= uvm_vnode.c -# sys/miscfs/syncfs -SRCS+= sync_subr.c sync_vnops.c - # sys/miscfs/deadfs SRCS+= dead_vfsops.c dead_vnops.c # sys/miscfs Index: sys/rump/librump/rumpvfs/rump_vfs.c =================================================================== RCS file: /cvsroot/src/sys/rump/librump/rumpvfs/rump_vfs.c,v retrieving revision 1.81 diff -p -u -4 -r1.81 rump_vfs.c --- sys/rump/librump/rumpvfs/rump_vfs.c 17 Nov 2014 14:30:31 -0000 1.81 +++ sys/rump/librump/rumpvfs/rump_vfs.c 1 May 2015 07:56:17 -0000 @@ -48,9 +48,8 @@ __KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v #include #include #include -#include #include #include Index: sys/sys/vnode.h =================================================================== RCS file: /cvsroot/src/sys/sys/vnode.h,v retrieving revision 1.254 diff -p -u -4 -r1.254 vnode.h --- sys/sys/vnode.h 20 Apr 2015 19:36:56 -0000 1.254 +++ sys/sys/vnode.h 1 May 2015 07:56:18 -0000 @@ -584,8 +584,9 @@ int vn_fifo_bypass(void *); /* initialise global vnode management */ void vntblinit(void); /* misc stuff */ +void sched_sync(void *); void vn_syncer_add_to_worklist(struct vnode *, int); void vn_syncer_remove_from_worklist(struct vnode *); int dorevoke(struct vnode *, kauth_cred_t); int rawdev_mounted(struct vnode *, struct vnode **);