Index: vfs_subr.c =================================================================== RCS file: /staff2/garrigue/repos/kernel/vfs_subr.c,v retrieving revision 1.1.1.3 retrieving revision 1.5 diff -u -r1.1.1.3 -r1.5 --- vfs_subr.c 2002/04/23 12:34:39 1.1.1.3 +++ vfs_subr.c 2002/04/24 01:21:21 1.5 @@ -227,6 +227,11 @@ #define SYNCER_MAXDELAY 32 static int syncer_maxdelay = SYNCER_MAXDELAY; /* maximum delay time */ static int syncdelay = 30; /* max time to delay syncing data */ +time_t asyncdelay = 0; /* time to ignore syncing data */ +/* no syncing done for asyncdelay seconds */ +SYSCTL_INT(_kern, OID_AUTO, asyncdelay, CTLFLAG_RW, &asyncdelay, 0, ""); +static time_t asynccount = 0; /* current time before syncing */ +SYSCTL_INT(_kern, OID_AUTO, asynccount, CTLFLAG_RD, &asynccount, 0, ""); static int filedelay = 30; /* time to delay syncing files */ SYSCTL_INT(_kern, OID_AUTO, filedelay, CTLFLAG_RW, &filedelay, 0, ""); static int dirdelay = 29; /* time to delay syncing directories */ @@ -1239,6 +1244,17 @@ for (;;) { kthread_suspend_check(td->td_proc); + /* Stop the syncer when 0 < asynccount <= asyncdelay */ + asynccount -= 1; + if (asynccount < -syncdelay || asynccount > asyncdelay) + asynccount = asyncdelay; + if (rushjob > 0) + asynccount = 0; + if (asynccount > 0) { + tsleep(&lbolt, PPAUSE, "syncer", 0); + continue; + } + starttime = time_second; /* @@ -2598,6 +2614,7 @@ * perform msync on all vnodes under a mount point * the mount point must be locked. */ +/* JG: Beware I added MNT_LAZY case when called from sync_fsync */ void vfs_msync(struct mount *mp, int flags) { @@ -2610,6 +2627,8 @@ tries = 5; mtx_lock(&mntvnode_mtx); loop: + if ((mp->mnt_flag & MNT_SOFTDEP) && (flags != MNT_LAZY)) + asynccount = 0; for (vp = TAILQ_FIRST(&mp->mnt_nvnodelist); vp != NULL; vp = nvp) { if (vp->v_mount != mp) { if (--tries > 0) @@ -2912,7 +2931,7 @@ } asyncflag = mp->mnt_flag & MNT_ASYNC; mp->mnt_flag &= ~MNT_ASYNC; - vfs_msync(mp, MNT_NOWAIT); + vfs_msync(mp, MNT_LAZY); VFS_SYNC(mp, MNT_LAZY, ap->a_cred, td); if (asyncflag) mp->mnt_flag |= MNT_ASYNC;