Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Add fstrans_startnowait()/fstrans_done() to vrele_t...



details:   https://anonhg.NetBSD.org/src/rev/012bfffe4970
branches:  trunk
changeset: 327797:012bfffe4970
user:      hannken <hannken%NetBSD.org@localhost>
date:      Mon Mar 17 09:27:37 2014 +0000

description:
Add fstrans_startnowait()/fstrans_done() to vrele_thread().

diffstat:

 sys/kern/vfs_vnode.c |  18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diffs (56 lines):

diff -r 6e2d45234ffe -r 012bfffe4970 sys/kern/vfs_vnode.c
--- a/sys/kern/vfs_vnode.c      Mon Mar 17 09:24:11 2014 +0000
+++ b/sys/kern/vfs_vnode.c      Mon Mar 17 09:27:37 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_vnode.c,v 1.33 2014/03/05 09:37:29 hannken Exp $   */
+/*     $NetBSD: vfs_vnode.c,v 1.34 2014/03/17 09:27:37 hannken Exp $   */
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -116,7 +116,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.33 2014/03/05 09:37:29 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.34 2014/03/17 09:27:37 hannken Exp $");
 
 #define _VFS_VNODE_PRIVATE
 
@@ -820,17 +820,27 @@
 static void
 vrele_thread(void *cookie)
 {
+       vnodelst_t skip_list;
        vnode_t *vp;
+       struct mount *mp;
 
+       TAILQ_INIT(&skip_list);
+
+       mutex_enter(&vrele_lock);
        for (;;) {
-               mutex_enter(&vrele_lock);
                while (TAILQ_EMPTY(&vrele_list)) {
                        vrele_gen++;
                        cv_broadcast(&vrele_cv);
                        cv_timedwait(&vrele_cv, &vrele_lock, hz);
+                       TAILQ_CONCAT(&vrele_list, &skip_list, v_freelist);
                }
                vp = TAILQ_FIRST(&vrele_list);
+               mp = vp->v_mount;
                TAILQ_REMOVE(&vrele_list, vp, v_freelist);
+               if (fstrans_start_nowait(mp, FSTRANS_LAZY) != 0) {
+                       TAILQ_INSERT_TAIL(&skip_list, vp, v_freelist);
+                       continue;
+               }
                vrele_pending--;
                mutex_exit(&vrele_lock);
 
@@ -840,6 +850,8 @@
                 */
                mutex_enter(vp->v_interlock);
                vrelel(vp, 0);
+               fstrans_done(mp);
+               mutex_enter(&vrele_lock);
        }
 }
 



Home | Main Index | Thread Index | Old Index