Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys Approved by thorpej:



details:   https://anonhg.NetBSD.org/src/rev/08e6362e76ca
branches:  netbsd-1-5
changeset: 488769:08e6362e76ca
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Thu Jul 27 02:46:49 2000 +0000

description:
Approved by thorpej:
Free the syncer vnode at unmount time.

syssrc/sys/kern/vfs_syscalls.c                          1.159 -> 1.160
syssrc/sys/miscfs/syncfs/sync_subr.c                    1.3 -> 1.4
syssrc/sys/miscfs/syncfs/sync_vnops.c                   1.2 -> 1.3
syssrc/sys/miscfs/syncfs/syncfs.h                       1.3 -> 1.4
syssrc/sys/sys/vnode.h                                  1.82 -> 1.83

diffstat:

 sys/kern/vfs_syscalls.c        |  14 +++++---------
 sys/miscfs/syncfs/sync_subr.c  |  20 +++++++++++++++++++-
 sys/miscfs/syncfs/sync_vnops.c |  24 ++++++++++++++++++++----
 sys/miscfs/syncfs/syncfs.h     |   3 ++-
 sys/sys/vnode.h                |   3 ++-
 5 files changed, 48 insertions(+), 16 deletions(-)

diffs (149 lines):

diff -r 6d63b8129126 -r 08e6362e76ca sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Thu Jul 27 02:31:03 2000 +0000
+++ b/sys/kern/vfs_syscalls.c   Thu Jul 27 02:46:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.158 2000/06/19 18:53:55 pooka Exp $ */
+/*     $NetBSD: vfs_syscalls.c,v 1.158.2.1 2000/07/27 02:46:49 mycroft Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -331,10 +331,8 @@
                        if (mp->mnt_syncer == NULL)
                                error = vfs_allocate_syncvnode(mp);
                } else {
-                       if (mp->mnt_syncer != NULL) {
-                               vgone(mp->mnt_syncer);
-                               mp->mnt_syncer = NULL;
-                       }
+                       if (mp->mnt_syncer != NULL)
+                               vfs_deallocate_syncvnode(mp);
                }
                vfs_unbusy(mp);
                return (error);
@@ -500,10 +498,8 @@
        async = mp->mnt_flag & MNT_ASYNC;
        mp->mnt_flag &= ~MNT_ASYNC;
        cache_purgevfs(mp);     /* remove cache entries for this file sys */
-       if (mp->mnt_syncer != NULL) {
-               vgone(mp->mnt_syncer);
-               mp->mnt_syncer = NULL;
-       }
+       if (mp->mnt_syncer != NULL)
+               vfs_deallocate_syncvnode(mp);
        if (((mp->mnt_flag & MNT_RDONLY) ||
            (error = VFS_SYNC(mp, MNT_WAIT, p->p_ucred, p)) == 0) ||
            (flags & MNT_FORCE))
diff -r 6d63b8129126 -r 08e6362e76ca sys/miscfs/syncfs/sync_subr.c
--- a/sys/miscfs/syncfs/sync_subr.c     Thu Jul 27 02:31:03 2000 +0000
+++ b/sys/miscfs/syncfs/sync_subr.c     Thu Jul 27 02:46:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sync_subr.c,v 1.3 1999/11/23 23:52:41 fvdl Exp $       */
+/*     $NetBSD: sync_subr.c,v 1.3.6.1 2000/07/27 02:46:51 mycroft Exp $        */
 
 /*
  * Copyright 1997 Marshall Kirk McKusick. All Rights Reserved.
@@ -132,6 +132,24 @@
 }
 
 /*
+ * Remove an item fromthe syncer work queue.
+ */
+void
+vn_syncer_remove_from_worklist(vp)
+       struct vnode *vp;
+{
+       int s;
+
+       s = splbio();
+
+       if (vp->v_flag & VONWORKLST) {
+               LIST_REMOVE(vp, v_synclist);
+       }
+
+       splx(s);
+}
+
+/*
  * System filesystem synchronizer daemon.
  */
 void 
diff -r 6d63b8129126 -r 08e6362e76ca sys/miscfs/syncfs/sync_vnops.c
--- a/sys/miscfs/syncfs/sync_vnops.c    Thu Jul 27 02:31:03 2000 +0000
+++ b/sys/miscfs/syncfs/sync_vnops.c    Thu Jul 27 02:46:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sync_vnops.c,v 1.2 1999/11/15 18:49:10 fvdl Exp $      */
+/*     $NetBSD: sync_vnops.c,v 1.2.6.1 2000/07/27 02:46:52 mycroft Exp $       */
 
 /*
  * Copyright 1997 Marshall Kirk McKusick. All Rights Reserved.
@@ -70,10 +70,9 @@
        int error;
 
        /* Allocate a new vnode */
-       if ((error = getnewvnode(VT_VFS, mp, sync_vnodeop_p, &vp)) != 0) {
-               mp->mnt_syncer = NULL;
+       if ((error = getnewvnode(VT_VFS, mp, sync_vnodeop_p, &vp)) != 0)
                return (error);
-       }
+
        vp->v_writecount = 1;
        vp->v_type = VNON;
        /*
@@ -98,6 +97,23 @@
 }
 
 /*
+ * Destroy the filesystem syncer vnode for the specified mount point.
+ */
+void
+vfs_deallocate_syncvnode(mp)
+       struct mount *mp;
+{
+       struct vnode *vp;
+
+       vp = mp->mnt_syncer;
+       mp->mnt_syncer = 0;
+       vn_syncer_remove_from_worklist(vp);
+       vp->v_writecount = 0;
+       vgone(vp);
+       vrele(vp);
+}
+
+/*
  * Do a lazy sync of the filesystem.
  */
 int
diff -r 6d63b8129126 -r 08e6362e76ca sys/miscfs/syncfs/syncfs.h
--- a/sys/miscfs/syncfs/syncfs.h        Thu Jul 27 02:31:03 2000 +0000
+++ b/sys/miscfs/syncfs/syncfs.h        Thu Jul 27 02:46:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syncfs.h,v 1.3 2000/03/30 02:21:49 simonb Exp $        */
+/*     $NetBSD: syncfs.h,v 1.3.4.1 2000/07/27 02:46:52 mycroft Exp $   */
 
 /*
  * Copyright 1997 Marshall Kirk McKusick. All Rights Reserved.
@@ -46,6 +46,7 @@
 void sched_sync __P((void *));
 void vn_initialize_syncerd __P((void));
 int vfs_allocate_syncvnode __P((struct mount *));
+void vfs_deallocate_syncvnode __P((struct mount *));
 
 extern int (**sync_vnodeop_p) __P((void *));
 
diff -r 6d63b8129126 -r 08e6362e76ca sys/sys/vnode.h
--- a/sys/sys/vnode.h   Thu Jul 27 02:31:03 2000 +0000
+++ b/sys/sys/vnode.h   Thu Jul 27 02:46:49 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnode.h,v 1.77.2.1 2000/07/03 17:34:49 fvdl Exp $      */
+/*     $NetBSD: vnode.h,v 1.77.2.2 2000/07/27 02:46:53 mycroft Exp $   */
 
 /*
  * Copyright (c) 1989, 1993
@@ -532,6 +532,7 @@
 int    vn_poll __P((struct file *fp, int events, struct proc *p));
 int    vn_stat __P((struct vnode *vp, struct stat *sb, struct proc *p));
 void   vn_syncer_add_to_worklist __P((struct vnode *vp, int delay));
+void   vn_syncer_remove_from_worklist __P((struct vnode *vp));
 int    vn_write __P((struct file *fp, off_t *offset, struct uio *uio,
            struct ucred *cred, int flags));
 int    vn_writechk __P((struct vnode *vp));



Home | Main Index | Thread Index | Old Index