Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Take out the `#ifdef USE_UFSHASH'; use ufs_hashl...



details:   https://anonhg.NetBSD.org/src/rev/c4af817b3ca2
branches:  trunk
changeset: 471798:c4af817b3ca2
user:      perseant <perseant%NetBSD.org@localhost>
date:      Sun Apr 11 23:24:04 1999 +0000

description:
Take out the `#ifdef USE_UFSHASH'; use ufs_hashlock to lock the inode free
list instead of free_lock.

diffstat:

 sys/ufs/lfs/lfs_alloc.c    |  44 ++------------------------------------------
 sys/ufs/lfs/lfs_syscalls.c |  21 ++++-----------------
 2 files changed, 6 insertions(+), 59 deletions(-)

diffs (181 lines):

diff -r 25b31b8493b1 -r c4af817b3ca2 sys/ufs/lfs/lfs_alloc.c
--- a/sys/ufs/lfs/lfs_alloc.c   Sun Apr 11 23:15:26 1999 +0000
+++ b/sys/ufs/lfs/lfs_alloc.c   Sun Apr 11 23:24:04 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_alloc.c,v 1.18 1999/03/24 05:51:30 mrg Exp $       */
+/*     $NetBSD: lfs_alloc.c,v 1.19 1999/04/11 23:24:04 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -94,11 +94,7 @@
 #include <ufs/lfs/lfs.h>
 #include <ufs/lfs/lfs_extern.h>
 
-#ifndef USE_UFS_HASHLOCK
-int free_lock = 0;
-#else
 extern struct lock ufs_hashlock;
-#endif
 
 /* Allocate a new inode. */
 /* ARGSUSED */
@@ -129,14 +125,8 @@
         * (this should be a proper lock, in struct lfs)
         */
 
-#ifndef USE_UFS_HASHLOCK
-       while(free_lock)
-               tsleep(&free_lock, PRIBIO+1, "lfs_free", 0);
-       free_lock++;
-#else
        while(lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0))
                ;
-#endif
 
        /* Get the head of the freelist. */
        new_ino = fs->lfs_free;
@@ -190,22 +180,11 @@
                ifp->if_nextfree = LFS_UNUSED_INUM;
                VOP_UNLOCK(vp,0);
                if ((error = VOP_BWRITE(bp)) != 0) {
-#ifndef USE_UFS_HASHLOCK
-                       free_lock--;
-                       wakeup(&free_lock);
-#else
                        lockmgr(&ufs_hashlock, LK_RELEASE, 0);
-#endif
                        return (error);
                }
        }
-
-#ifndef USE_UFS_HASHLOCK
-       free_lock--;
-       wakeup(&free_lock);
-#else
        lockmgr(&ufs_hashlock, LK_RELEASE, 0);
-#endif
 
 #ifdef DIAGNOSTIC
        if(fs->lfs_free == LFS_UNUSED_INUM)
@@ -321,33 +300,19 @@
        
        while(WRITEINPROG(ap->a_pvp)
              || fs->lfs_seglock
-#ifndef USE_UFS_HASHLOCK
-             || free_lock
-#else
-             || lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0)
-#endif
-             )
+             || lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0))
        {
                if (WRITEINPROG(ap->a_pvp)) {
                        tsleep(ap->a_pvp, (PRIBIO+1), "lfs_vfree", 0);
                }
-               if(free_lock)
-                       tsleep(&free_lock, PRIBIO+1, "free_lock", 0);
                if (fs->lfs_seglock) {
                        if (fs->lfs_lockpid == curproc->p_pid) {
-#if 0
-                               panic("lfs_vfree: we hold the seglock");
-#else
                                break;
-#endif
                        } else {
                                tsleep(&fs->lfs_seglock, PRIBIO + 1, "lfs_vfr1", 0);
                        }
                }
        }
-#ifndef USE_UFS_HASHLOCK
-       free_lock++;
-#endif
        
        if (ip->i_flag & IN_CLEANING) {
                --fs->lfs_uinodes;
@@ -392,12 +357,7 @@
                sup->su_nbytes -= DINODE_SIZE;
                (void) VOP_BWRITE(bp);
        }
-#ifndef USE_UFS_HASHLOCK
-       free_lock--;
-       wakeup(&free_lock);
-#else
        lockmgr(&ufs_hashlock, LK_RELEASE, 0);
-#endif
        
        /* Set superblock modified bit and decrement file count. */
        fs->lfs_fmod = 1;
diff -r 25b31b8493b1 -r c4af817b3ca2 sys/ufs/lfs/lfs_syscalls.c
--- a/sys/ufs/lfs/lfs_syscalls.c        Sun Apr 11 23:15:26 1999 +0000
+++ b/sys/ufs/lfs/lfs_syscalls.c        Sun Apr 11 23:24:04 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_syscalls.c,v 1.26 1999/03/29 22:13:07 perseant Exp $       */
+/*     $NetBSD: lfs_syscalls.c,v 1.27 1999/04/11 23:24:04 perseant Exp $       */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -875,9 +875,7 @@
  * In either case we lfs_vref, and it is the caller's responsibility to
  * lfs_vunref and VOP_UNLOCK (if necessary) when finished.
  */
-#ifdef USE_UFS_HASHLOCK
 extern struct lock ufs_hashlock;
-#endif
 
 int
 lfs_fastvget(mp, ino, daddr, vpp, dinp, need_unlock)
@@ -903,24 +901,19 @@
         * locked, in which case they are going to be distinctly unhappy
         * if we trash something.
         */
-#ifdef USE_UFS_HASHLOCK
        do {
-#endif
                if ((*vpp = ufs_ihashlookup(dev, ino)) != NULL) {
-                       lfs_vref(*vpp);
                        if ((*vpp)->v_flag & VXLOCK) {
-                               printf("vnode VXLOCKed for ino %d\n",ino);
+                               printf("lfs_fastvget: vnode VXLOCKed for ino %d\n",ino);
                                clean_vnlocked++;
 #ifdef LFS_EAGAIN_FAIL
-#if 0 /* XXXX KS */
-                               lfs_vunref(*vpp);
-#endif
                                return EAGAIN;
 #endif
                        }
                        ip = VTOI(*vpp);
+                       lfs_vref(*vpp);
                        if (VOP_ISLOCKED(*vpp)) {
-                               printf("ino %d inlocked by pid %d\n",ip->i_number,
+                               printf("lfs_fastvget: ino %d inlocked by pid %d\n",ip->i_number,
                                       ip->i_lock.lk_lockholder);
                                clean_inlocked++;
 #ifdef LFS_EAGAIN_FAIL
@@ -933,16 +926,12 @@
                        }
                        return (0);
                }
-#ifdef USE_UFS_HASHLOCK
        } while (lockmgr(&ufs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, 0));
-#endif
 
        /* Allocate new vnode/inode. */
        if ((error = lfs_vcreate(mp, ino, &vp)) != 0) {
                *vpp = NULL;
-#ifdef USE_UFS_HASHLOCK
                lockmgr(&ufs_hashlock, LK_RELEASE, 0);
-#endif
                return (error);
        }
        /*
@@ -953,9 +942,7 @@
         */
        ip = VTOI(vp);
        ufs_ihashins(ip);
-#ifdef USE_UFS_HASHLOCK
        lockmgr(&ufs_hashlock, LK_RELEASE, 0);
-#endif
        
        /*
         * XXX



Home | Main Index | Thread Index | Old Index