Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Let syncer try fstrans_start() before running VFS_S...



details:   https://anonhg.NetBSD.org/src/rev/9c506c80c6ab
branches:  trunk
changeset: 351530:9c506c80c6ab
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Feb 17 08:25:15 2017 +0000

description:
Let syncer try fstrans_start() before running VFS_SYNC() to get rid
of the syncer lock/unlock from vfs_suspend().

diffstat:

 sys/kern/vfs_subr.c  |  10 +++++++---
 sys/kern/vfs_trans.c |  10 +++-------
 2 files changed, 10 insertions(+), 10 deletions(-)

diffs (77 lines):

diff -r db77c3652f82 -r 9c506c80c6ab sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Fri Feb 17 08:24:07 2017 +0000
+++ b/sys/kern/vfs_subr.c       Fri Feb 17 08:25:15 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.459 2017/01/11 14:52:02 hannken Exp $   */
+/*     $NetBSD: vfs_subr.c,v 1.460 2017/02/17 08:25:15 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.459 2017/01/11 14:52:02 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.460 2017/02/17 08:25:15 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -83,6 +83,7 @@
 #include <sys/filedesc.h>
 #include <sys/kernel.h>
 #include <sys/mount.h>
+#include <sys/fstrans.h>
 #include <sys/vnode_impl.h>
 #include <sys/stat.h>
 #include <sys/sysctl.h>
@@ -782,7 +783,10 @@
                        mp->mnt_synclist_slot = sync_delay_slot(sync_delay(mp));
                        if (vfs_busy(mp, &nmp))
                                continue;
-                       VFS_SYNC(mp, MNT_LAZY, curlwp->l_cred);
+                       if (fstrans_start_nowait(mp, FSTRANS_SHARED) == 0) {
+                               VFS_SYNC(mp, MNT_LAZY, curlwp->l_cred);
+                               fstrans_done(mp);
+                       }
                        vfs_unbusy(mp, false, &nmp);
                }
                mutex_exit(&mountlist_lock);
diff -r db77c3652f82 -r 9c506c80c6ab sys/kern/vfs_trans.c
--- a/sys/kern/vfs_trans.c      Fri Feb 17 08:24:07 2017 +0000
+++ b/sys/kern/vfs_trans.c      Fri Feb 17 08:25:15 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_trans.c,v 1.35 2017/02/17 08:24:07 hannken Exp $   */
+/*     $NetBSD: vfs_trans.c,v 1.36 2017/02/17 08:25:15 hannken Exp $   */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.35 2017/02/17 08:24:07 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_trans.c,v 1.36 2017/02/17 08:25:15 hannken Exp $");
 
 /*
  * File system transaction operations.
@@ -506,11 +506,8 @@
        } else
                mutex_enter(&vfs_suspend_lock);
 
-       mutex_enter(&syncer_mutex);
-       if ((error = VFS_SUSPENDCTL(mp, SUSPEND_SUSPEND)) != 0) {
-               mutex_exit(&syncer_mutex);
+       if ((error = VFS_SUSPENDCTL(mp, SUSPEND_SUSPEND)) != 0)
                mutex_exit(&vfs_suspend_lock);
-       }
 
        return error;
 }
@@ -523,7 +520,6 @@
 {
 
        VFS_SUSPENDCTL(mp, SUSPEND_RESUME);
-       mutex_exit(&syncer_mutex);
        mutex_exit(&vfs_suspend_lock);
 }
 



Home | Main Index | Thread Index | Old Index