From bdc7c508f4dd084adf6f1cbc7719cf743fc30616 Mon Sep 17 00:00:00 2001 From: kib Date: Tue, 21 Feb 2012 01:37:27 +0000 Subject: [PATCH 148/175] MFC r231160 (by mckusick): Do not fsync all resident UFS vnodes from the syncer vnode call to ffs_sync(). Since all inode metadata updates are translated to inodeblock updates, the vnodes syncing is handled by syncer dirty buffer wheel. The only things that shall be synced by ffs_sync() from the syncer calls are the filesystem metadata proper. git-svn-id: http://svn.freebsd.org/base/stable/9@231952 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f (cherry picked from commit f776bd8e23d5044ae4a87f00b8b8a9590740daae) Signed-off-by: Xin Li --- sys/ufs/ffs/ffs_vfsops.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 27e6bbc..cb8ed580 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1431,6 +1431,9 @@ ffs_sync(mp, waitfor) int softdep_accdeps; struct bufobj *bo; + wait = 0; + suspend = 0; + suspended = 0; td = curthread; fs = ump->um_fs; if (fs->fs_fmod != 0 && fs->fs_ronly != 0 && ump->um_fsckpid == 0) { @@ -1438,11 +1441,17 @@ ffs_sync(mp, waitfor) panic("ffs_sync: rofs mod"); } /* + * For a lazy sync, we just care about the filesystem metadata. + */ + if (waitfor == MNT_LAZY) { + secondary_accwrites = 0; + secondary_writes = 0; + lockreq = 0; + goto metasync; + } + /* * Write back each (modified) inode. */ - wait = 0; - suspend = 0; - suspended = 0; lockreq = LK_EXCLUSIVE | LK_NOWAIT; if (waitfor == MNT_SUSPEND) { suspend = 1; @@ -1513,11 +1522,12 @@ loop: #ifdef QUOTA qsync(mp); #endif + +metasync: devvp = ump->um_devvp; bo = &devvp->v_bufobj; BO_LOCK(bo); - if (waitfor != MNT_LAZY && - (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0)) { + if (bo->bo_numoutput > 0 || bo->bo_dirty.bv_cnt > 0) { BO_UNLOCK(bo); vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY); if ((error = VOP_FSYNC(devvp, waitfor, td)) != 0) -- 1.7.9.4