Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs clean up unused/required #ifdefs



details:   https://anonhg.NetBSD.org/src/rev/260042a354c7
branches:  trunk
changeset: 467546:260042a354c7
user:      perseant <perseant%NetBSD.org@localhost>
date:      Thu Mar 25 21:39:18 1999 +0000

description:
clean up unused/required #ifdefs

diffstat:

 sys/ufs/lfs/lfs.h          |   15 +-----
 sys/ufs/lfs/lfs_bio.c      |   19 +------
 sys/ufs/lfs/lfs_inode.c    |   12 ++-
 sys/ufs/lfs/lfs_segment.c  |  116 ++++++++------------------------------------
 sys/ufs/lfs/lfs_subr.c     |    6 +-
 sys/ufs/lfs/lfs_syscalls.c |  116 +-------------------------------------------
 sys/ufs/lfs/lfs_vfsops.c   |   21 +------
 sys/ufs/lfs/lfs_vnops.c    |   19 +------
 8 files changed, 41 insertions(+), 283 deletions(-)

diffs (truncated from 803 to 300 lines):

diff -r 64839f3bcb7d -r 260042a354c7 sys/ufs/lfs/lfs.h
--- a/sys/ufs/lfs/lfs.h Thu Mar 25 21:19:08 1999 +0000
+++ b/sys/ufs/lfs/lfs.h Thu Mar 25 21:39:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs.h,v 1.13 1999/03/17 18:38:34 perseant Exp $        */
+/*     $NetBSD: lfs.h,v 1.14 1999/03/25 21:39:18 perseant Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -74,13 +74,7 @@
  * Compile-time options for LFS.
  */
 #define LFS_EAGAIN_FAIL          /* markv fail with EAGAIN if ino is locked */
-#define LFS_CONSERVATIVE_LOCK    /* lock ifile ino in lfs_segwrite, if safe */
-
-#define LFS_TOGGLE_SB           /* toggle between first 2 sbs for checkpoint */
-#define LFS_TRACK_IOS           /* attempt to avoid cleaning segments not yet fully written to disk */
-#define LFS_USEDIROP            /* use VDIROP segregation */
-#define LFS_STINGY_CLEAN        /* write only cleaned inodes when cleaning */
-#define LFS_STINGY_BLOCKS       /* write only cleaned blocks when cleaning */
+#define LFS_TRACK_IOS            /* attempt to avoid cleaning segments not yet fully written to disk */
 #define LFS_CANNOT_ROLLFW       /* No roll-forward agent exists */
 
 /* #define DEBUG_LFS */              /* Intensive debugging of LFS subsystem */
@@ -311,21 +305,16 @@
        int8_t    lfs_fmod;             /* super block modified flag */
        int8_t    lfs_ronly;            /* mounted read-only flag */
        int8_t    lfs_flags;            /* currently unused flag */
-#ifdef LFS_TOGGLE_SB
        u_int16_t lfs_activesb;         /* toggle between superblocks */
-#endif /* LFS_TOGGLE_SB */
 #ifdef LFS_TRACK_IOS
        daddr_t   lfs_pending[LFS_THROTTLE]; /* daddrs of pending writes */
 #endif /* LFS_TRACK_IOS */
-#ifdef LFS_USEDIROP
 # define LFS_MAXDIROP 32
        int       lfs_dirvcount;        /* number of VDIROP-marked vnodes */
-#endif /* LFS_USEDIROP */      
 #ifdef LFS_CANNOT_ROLLFW
        daddr_t   lfs_sbactive;         /* disk address of in-progress sb write */
 #endif
        struct vnode *lfs_flushvp;      /* vnode being flushed */
-       int       lfs_loanedbytes;      /* Temp. byte loans for removed inodes */
 };
 
 /*
diff -r 64839f3bcb7d -r 260042a354c7 sys/ufs/lfs/lfs_bio.c
--- a/sys/ufs/lfs/lfs_bio.c     Thu Mar 25 21:19:08 1999 +0000
+++ b/sys/ufs/lfs/lfs_bio.c     Thu Mar 25 21:39:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_bio.c,v 1.7 1999/03/10 00:20:00 perseant Exp $     */
+/*     $NetBSD: lfs_bio.c,v 1.8 1999/03/25 21:39:18 perseant Exp $     */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -228,11 +228,6 @@
                }
                
                ip = VTOI(bp->b_vp);
-#ifndef LFS_STINGY_CLEAN
-               if (!(ip->i_flag & IN_MODIFIED))
-                       ++fs->lfs_uinodes;
-               ip->i_flag |= IN_CHANGE | IN_MODIFIED | IN_UPDATE;
-#else /* LFS_STINGY_CLEAN */
                if ((bp->b_flags & (B_CALL|B_INVAL)) == (B_CALL|B_INVAL))
                {
                        if(!(ip->i_flag & IN_CLEANING))
@@ -243,7 +238,6 @@
                                ++fs->lfs_uinodes;
                        ip->i_flag |= IN_CHANGE | IN_MODIFIED | IN_UPDATE;
                }
-#endif /* LFS_STINGY_CLEAN */
                fs->lfs_avail -= db;
                ++locked_queue_count;
                locked_queue_bytes += bp->b_bufsize;
@@ -260,17 +254,6 @@
                        bp->b_flags |= B_DELWRI | B_LOCKED;
                bp->b_flags &= ~(B_READ | B_ERROR);
                s = splbio();
-               /* XXX - KS - if it's fake and there's another in core, forget it */
-               if((bp->b_flags & (B_CALL|B_INVAL)) == (B_CALL|B_INVAL)
-                  && incore(bp->b_vp,bp->b_lblkno))
-               {
-#ifdef DIAGNOSTIC
-                       printf("lfs_bwrite_ext: dropping fake buffer %d/%d",VTOI(bp->b_vp)->i_number, bp->b_lblkno);
-#endif
-                       lfs_freebuf(bp);
-                       splx(s);
-                       return 0;
-               }
                reassignbuf(bp, bp->b_vp);
                splx(s);
        }
diff -r 64839f3bcb7d -r 260042a354c7 sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Thu Mar 25 21:19:08 1999 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Thu Mar 25 21:39:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.19 1999/03/24 05:51:31 mrg Exp $       */
+/*     $NetBSD: lfs_inode.c,v 1.20 1999/03/25 21:39:18 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -237,15 +237,17 @@
                return (VOP_UPDATE(vp, NULL, NULL, 0));
        }
 
-#if 0
        /*
-        * Make sure no writes happen while we're truncating
-        * XXX KS - I don't remember why....
+        * Make sure no writes happen while we're truncating.
+        * Otherwise, blocks which are accounted for on the inode
+        * *and* which have been created for cleaning can coexist,
+        * and cause us to overcount, and panic below.
+        *
+        * XXX KS - too restrictive?  Maybe only when cleaning?
         */
        while(fs->lfs_seglock) {
                tsleep(&fs->lfs_seglock, (PRIBIO+1), "lfs_truncate", 0);
        }
-#endif
        
        /*
         * Calculate index into inode's block list of last direct and indirect
diff -r 64839f3bcb7d -r 260042a354c7 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Thu Mar 25 21:19:08 1999 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Thu Mar 25 21:39:18 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.15 1999/03/10 00:20:00 perseant Exp $        */
+/*     $NetBSD: lfs_segment.c,v 1.16 1999/03/25 21:39:18 perseant Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -70,6 +70,8 @@
  *     @(#)lfs_segment.c       8.10 (Berkeley) 6/10/95
  */
 
+#define ivndebug(vp,str) printf("ino %d: %s\n",VTOI(vp)->i_number,(str))
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/namei.h>
@@ -260,18 +262,11 @@
        return (0);
 }
 
-#define vndebug(vp,str) if(VTOI(vp)->i_flag & IN_CLEANING) printf("not writing ino %d because %s\n",VTOI(vp)->i_number,(str))
-
-/* XXX KS - This is ugly */
-#define BYTE_BORROW(FS,SP,SZ) do {                        \
-        SEGUSE *_sup;                                     \
-        struct buf *_bp;                                  \
-                                                          \
-        LFS_SEGENTRY(_sup, (FS), (SP)->seg_number, _bp);  \
-        _sup->su_nbytes += (SZ);                          \
-        (FS)->lfs_loaned_bytes += (SZ);                   \
-        VOP_BWRITE(_bp);                                  \
-} while(0)
+#ifdef DEBUG_LFS_VERBOSE
+# define vndebug(vp,str) if(VTOI(vp)->i_flag & IN_CLEANING) printf("not writing ino %d because %s (op %d)\n",VTOI(vp)->i_number,(str),op)
+#else
+# define vndebug(vp,str)
+#endif
 
 int
 lfs_writevnodes(fs, mp, sp, op)
@@ -309,13 +304,11 @@
                        goto loop;
 
                ip = VTOI(vp);
-#ifdef LFS_USEDIROP
                if ((op == VN_DIROP && !(vp->v_flag & VDIROP)) ||
                    (op != VN_DIROP && op != VN_CLEAN && (vp->v_flag & VDIROP))) {
                        vndebug(vp,"dirop");
                        continue;
                }
-#endif /* LFS_USEDIROP */
                
                if (op == VN_EMPTY && vp->v_dirtyblkhd.lh_first) {
                        vndebug(vp,"empty");
@@ -326,46 +319,26 @@
                        continue;
                }
 
-#ifdef LFS_STINGY_CLEAN
                if(op == VN_CLEAN && ip->i_number != LFS_IFILE_INUM
                   && !(ip->i_flag & IN_CLEANING)) {
                        vndebug(vp,"cleaning");
                        continue;
                }
-#endif /* LFS_STINGY_CLEAN */
 
                if (lfs_vref(vp)) {
                        vndebug(vp,"vref");
                        continue;
                }
 
-#ifdef LFS_USEDIROP
-               /*
-                * A removed Inode from a dirop we're writing
-                */
-               if((vp->v_flag & VDIROP)
-                  && !WRITEINPROG(vp)
-                  && vp->v_usecount<3
-                  && ip->i_ffs_nlink == 0
-                  && !VOP_ISLOCKED(vp))
-               {
-                       vndebug(vp,"vinactive");
-                       --fs->lfs_dirvcount;
-                       vp->v_flag &= ~VDIROP;
-                       wakeup(&fs->lfs_dirvcount);
-                       /*
-                        * vrele() will call VOP_INACTIVE for us, if
-                        * there are no active references to this vnode
-                        * (i.e. it was really removed).
-                        */
-                       if(vp->v_usecount==2)
-                               lfs_vunref(vp);
-                       VOP_LOCK(vp,LK_EXCLUSIVE);
-                       vput(vp);
-                       continue; /* Don't lfs_vunref again */
+#if 0 /* XXX KS - if we skip the ifile, things could go badly for us. */
+               if(WRITEINPROG(vp)) {
+                       lfs_vunref(vp);
+#ifdef DEBUG_LFS
+                       ivndebug(vp,"writevnodes/writeinprog");
+#endif
+                       continue;
                }
-#endif /* LFS_USEDIROP */
-
+#endif
                /*
                 * Write the inode/file if dirty and it's not the
                 * the IFILE.
@@ -382,7 +355,7 @@
                        if(vp->v_dirtyblkhd.lh_first != NULL) {
                                if(WRITEINPROG(vp)) {
 #ifdef DEBUG_LFS
-                                       printf("W");
+                                       ivndebug(vp,"writevnodes/write2");
 #endif
                                } else if(!(ip->i_flag & (IN_ACCESS|IN_CHANGE|IN_MODIFIED|IN_UPDATE|IN_CLEANING))) {
 #ifdef DEBUG_LFS
@@ -396,14 +369,12 @@
                        inodes_written++;
                }
 
-#ifdef LFS_USEDIROP
                if(vp->v_flag & VDIROP) {
                        --fs->lfs_dirvcount;
                        vp->v_flag &= ~VDIROP;
                        wakeup(&fs->lfs_dirvcount);
                        lfs_vunref(vp);
                }
-#endif /* LFS_USEDIROP */
 
                lfs_vunref(vp);
        }
@@ -433,9 +404,7 @@
        ufs_daddr_t ibno;
        int do_ckp, error, i;
        int writer_set = 0;
-#ifdef LFS_CONSERVATIVE_LOCK
        int need_unlock = 0;
-#endif /* LFS_CONSERVATIVE_LOCK */
        
        fs = VFSTOUFS(mp)->um_lfs;
 
@@ -473,17 +442,13 @@
        sp = fs->lfs_sp;
 
        /*
-        * XXX KS - If lfs_flushvp is non-NULL, we are called from
-        * lfs_vflush, in which case we have to flush *all* buffers
-        * off of this vnode.
+        * If lfs_flushvp is non-NULL, we are called from lfs_vflush,
+        * in which case we have to flush *all* buffers off of this vnode.
         */
-#ifdef LFS_STINGY_CLEAN
        if((sp->seg_flags & SEGM_CLEAN) && !(fs->lfs_flushvp))
                lfs_writevnodes(fs, mp, sp, VN_CLEAN);
        else {
-#endif /* LFS_STINGY_CLEAN */
                lfs_writevnodes(fs, mp, sp, VN_REG);
-#ifdef LFS_USEDIROP
                /*
                 * XXX KS - If we're cleaning, we can't wait for dirops,
                 * because they might be waiting on us.  The downside of this
@@ -505,15 +470,7 @@
                        lfs_writevnodes(fs, mp, sp, VN_DIROP);
                        ((SEGSUM *)(sp->segsum))->ss_flags &= ~(SS_CONT);
                }
-#if defined(DEBUG_LFS) && !defined(LFS_STINGY_BLOCKS)
-               else if(fs->lfs_dirops) {
-                       printf("ignoring active dirops in favor of the cleaner\n");
-               }
-#endif /* DEBUG_LFS && !LFS_STINGY_BLOCKS */
-#endif /* LFS_USEDIROP */
-#ifdef LFS_STINGY_CLEAN



Home | Main Index | Thread Index | Old Index