Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Feb 2012 10:16:17 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r231967 - stable/8/sys/ufs/ffs
Message-ID:  <201202211016.q1LAGHAP093637@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Feb 21 10:16:17 2012
New Revision: 231967
URL: http://svn.freebsd.org/changeset/base/231967

Log:
  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.
  
  Approved by:	re (bz)

Modified:
  stable/8/sys/ufs/ffs/ffs_vfsops.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/8/sys/ufs/ffs/ffs_vfsops.c	Tue Feb 21 10:13:37 2012	(r231966)
+++ stable/8/sys/ufs/ffs/ffs_vfsops.c	Tue Feb 21 10:16:17 2012	(r231967)
@@ -1321,17 +1321,26 @@ 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)
 		panic("%s: ffs_sync: modification on read-only filesystem",
 		    fs->fs_fsmnt);
 	/*
+	 * 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;
@@ -1402,11 +1411,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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202211016.q1LAGHAP093637>