Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Free the on disk inodes in the reclaim routine.



details:   https://anonhg.NetBSD.org/src/rev/4b686555695a
branches:  trunk
changeset: 756814:4b686555695a
user:      hannken <hannken%NetBSD.org@localhost>
date:      Wed Aug 04 10:43:53 2010 +0000

description:
Free the on disk inodes in the reclaim routine.

diffstat:

 sys/ufs/lfs/lfs_vnops.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (44 lines):

diff -r 66d3016382f7 -r 4b686555695a sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c   Wed Aug 04 10:17:50 2010 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c   Wed Aug 04 10:43:53 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_vnops.c,v 1.230 2010/07/29 10:54:51 hannken Exp $  */
+/*     $NetBSD: lfs_vnops.c,v 1.231 2010/08/04 10:43:53 hannken Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.230 2010/07/29 10:54:51 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.231 2010/08/04 10:43:53 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -277,6 +277,10 @@
        if (fs->lfs_ronly)
                return 0;
 
+       /* If a removed vnode is being cleaned, no need to sync here. */
+       if ((ap->a_flags & FSYNC_RECLAIM) != 0 && ip->i_mode == 0)
+               return 0;
+
        /*
         * Trickle sync simply adds this vnode to the pager list, as if
         * the pagedaemon had requested a pageout.
@@ -1075,6 +1079,14 @@
        struct lfs *fs = ip->i_lfs;
        int error;
 
+       /*
+        * The inode must be freed and updated before being removed
+        * from its hash chain.  Other threads trying to gain a hold
+        * on the inode will be stalled because it is locked (VI_XLOCK).
+        */
+       if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
+               lfs_vfree(vp, ip->i_number, ip->i_omode);
+
        mutex_enter(&lfs_lock);
        LFS_CLR_UINO(ip, IN_ALLMOD);
        mutex_exit(&lfs_lock);



Home | Main Index | Thread Index | Old Index