Source-Changes-HG archive

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

[src/trunk]: src/sys Untangle VFS_SYNC() from VFS_SUSPENDCTL().



details:   https://anonhg.NetBSD.org/src/rev/60af8ab68127
branches:  trunk
changeset: 821786:60af8ab68127
user:      hannken <hannken%NetBSD.org@localhost>
date:      Fri Feb 17 08:29:11 2017 +0000

description:
Untangle VFS_SYNC() from VFS_SUSPENDCTL().

diffstat:

 sys/dev/fss.c                   |   8 +++++---
 sys/fs/msdosfs/msdosfs_vfsops.c |   9 +++------
 sys/ufs/ffs/ffs_snapshot.c      |   9 ++++++---
 sys/ufs/ffs/ffs_vfsops.c        |  13 +++----------
 4 files changed, 17 insertions(+), 22 deletions(-)

diffs (126 lines):

diff -r ba2aed89663d -r 60af8ab68127 sys/dev/fss.c
--- a/sys/dev/fss.c     Fri Feb 17 08:27:58 2017 +0000
+++ b/sys/dev/fss.c     Fri Feb 17 08:29:11 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fss.c,v 1.95 2016/07/31 12:17:36 hannken Exp $ */
+/*     $NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.95 2016/07/31 12:17:36 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.96 2017/02/17 08:29:11 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -851,7 +851,9 @@
 
        microtime(&sc->sc_time);
 
-       error = fscow_establish(sc->sc_mount, fss_copy_on_write, sc);
+       error = VFS_SYNC(sc->sc_mount, MNT_WAIT, curlwp->l_cred);
+       if (error == 0)
+               error = fscow_establish(sc->sc_mount, fss_copy_on_write, sc);
        if (error == 0)
                sc->sc_flags |= FSS_ACTIVE;
 
diff -r ba2aed89663d -r 60af8ab68127 sys/fs/msdosfs/msdosfs_vfsops.c
--- a/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Feb 17 08:27:58 2017 +0000
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c   Fri Feb 17 08:29:11 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vfsops.c,v 1.120 2017/02/17 08:27:20 hannken Exp $     */
+/*     $NetBSD: msdosfs_vfsops.c,v 1.121 2017/02/17 08:29:11 hannken Exp $     */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.120 2017/02/17 08:27:20 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.121 2017/02/17 08:29:11 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -1120,10 +1120,7 @@
        case SUSPEND_SUSPEND:
                if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDING)) != 0)
                        return error;
-               error = msdosfs_sync(mp, MNT_WAIT, l->l_proc->p_cred);
-               if (error == 0)
-                       error = fstrans_setstate(mp, FSTRANS_SUSPENDED);
-               if (error != 0) {
+               if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDED)) != 0) {
                        (void) fstrans_setstate(mp, FSTRANS_NORMAL);
                        return error;
                }
diff -r ba2aed89663d -r 60af8ab68127 sys/ufs/ffs/ffs_snapshot.c
--- a/sys/ufs/ffs/ffs_snapshot.c        Fri Feb 17 08:27:58 2017 +0000
+++ b/sys/ufs/ffs/ffs_snapshot.c        Fri Feb 17 08:29:11 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_snapshot.c,v 1.143 2016/10/28 20:38:12 jdolecek Exp $      */
+/*     $NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 08:29:11 hannken Exp $       */
 
 /*
  * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.143 2016/10/28 20:38:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.144 2017/02/17 08:29:11 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -254,10 +254,13 @@
         * All allocations are done, so we can now suspend the filesystem.
         */
        error = vfs_suspend(vp->v_mount, 0);
+       if (error == 0) {
+               suspended = true;
+               error = VFS_SYNC(vp->v_mount, MNT_WAIT, curlwp->l_cred);
+       }
        vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
        if (error)
                goto out;
-       suspended = true;
        getmicrotime(&starttime);
        /*
         * First, copy all the cylinder group maps that have changed.
diff -r ba2aed89663d -r 60af8ab68127 sys/ufs/ffs/ffs_vfsops.c
--- a/sys/ufs/ffs/ffs_vfsops.c  Fri Feb 17 08:27:58 2017 +0000
+++ b/sys/ufs/ffs/ffs_vfsops.c  Fri Feb 17 08:29:11 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ffs_vfsops.c,v 1.343 2017/02/17 08:26:41 hannken Exp $ */
+/*     $NetBSD: ffs_vfsops.c,v 1.344 2017/02/17 08:29:11 hannken Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.343 2017/02/17 08:26:41 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.344 2017/02/17 08:29:11 hannken Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -2408,14 +2408,7 @@
        case SUSPEND_SUSPEND:
                if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDING)) != 0)
                        return error;
-               error = ffs_sync(mp, MNT_WAIT, l->l_proc->p_cred);
-               if (error == 0)
-                       error = fstrans_setstate(mp, FSTRANS_SUSPENDED);
-#ifdef WAPBL
-               if (error == 0 && mp->mnt_wapbl)
-                       error = wapbl_flush(mp->mnt_wapbl, 1);
-#endif
-               if (error != 0) {
+               if ((error = fstrans_setstate(mp, FSTRANS_SUSPENDED)) != 0) {
                        (void) fstrans_setstate(mp, FSTRANS_NORMAL);
                        return error;
                }



Home | Main Index | Thread Index | Old Index