Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Make sysctl variable lfs_clean_vnhead do what it...



details:   https://anonhg.NetBSD.org/src/rev/1d4e0dadb6be
branches:  trunk
changeset: 467555:1d4e0dadb6be
user:      perseant <perseant%NetBSD.org@localhost>
date:      Thu Mar 25 22:38:28 1999 +0000

description:
Make sysctl variable lfs_clean_vnhead do what it was supposed to do,
namely, toggle whether vnodes loaded only for cleaning (as opposed to
normal filesystem use) are freed to the *head* of the vnode free list,
rather than the tail.  This should avoid a possible cache flushing
effect, if the cleaner cleans a segment containing a large number of
live inodes.

diffstat:

 sys/ufs/lfs/lfs_segment.c |  21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diffs (60 lines):

diff -r cbdf0f1c26a2 -r 1d4e0dadb6be sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Thu Mar 25 22:33:03 1999 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Thu Mar 25 22:38:28 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.19 1999/03/25 22:26:52 perseant Exp $        */
+/*     $NetBSD: lfs_segment.c,v 1.20 1999/03/25 22:38:28 perseant Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -135,6 +135,7 @@
 
 int    lfs_allclean_wakeup;            /* Cleaner wakeup address. */
 int    lfs_writeindir = 1;             /* whether to flush indir on non-ckp */
+int    lfs_clean_vnhead = 1;           /* Allow freeing to head of vn list */
 
 /* Statistics Counters */
 int lfs_dostats = 1;
@@ -280,7 +281,7 @@
 {
        struct inode *ip;
        struct vnode *vp;
-       int inodes_written=0;
+       int inodes_written=0, only_cleaning;
 
 #ifndef LFS_NO_BACKVP_HACK
        /* BEGIN HACK */
@@ -350,6 +351,8 @@
                     (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE | IN_CLEANING) ||
                     vp->v_dirtyblkhd.lh_first != NULL))
                {
+                       only_cleaning = ((ip->i_flag & (IN_ACCESS|IN_CHANGE|IN_MODIFIED|IN_UPDATE|IN_CLEANING))==IN_CLEANING);
+
                        if(ip->i_number != LFS_IFILE_INUM
                           && vp->v_dirtyblkhd.lh_first != NULL)
                        {
@@ -379,20 +382,14 @@
                        lfs_vunref(vp);
                }
 
-               lfs_vunref(vp);
+               if(lfs_clean_vnhead && only_cleaning)
+                       lfs_vunref_head(vp);
+               else
+                       lfs_vunref(vp);
        }
        return inodes_written;
 }
 
-/*
- * There is a distinct difference in the interpretation of SEGM_CLEAN,
- * depending on whether it is passed *directly* to lfs_segwrite (i.e., we
- * were called from lfs_markv), or whether it was just in the segment flags
- * (we were called indirectly through getnewvnode/lfs_vflush).  In the former
- * case, we only want to write vnodes where cleaning is in progress; but
- * in the latter case, we might want to write all empty vnodes, or possibly
- * all vnodes.
- */
 int
 lfs_segwrite(mp, flags)
        struct mount *mp;



Home | Main Index | Thread Index | Old Index