Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs don't guard lfs_reshash with splbio, lfs_lock is...



details:   https://anonhg.NetBSD.org/src/rev/3487a5f685e3
branches:  trunk
changeset: 822768:3487a5f685e3
user:      maya <maya%NetBSD.org@localhost>
date:      Thu Apr 06 03:12:48 2017 +0000

description:
don't guard lfs_reshash with splbio, lfs_lock is plenty

diffstat:

 sys/ufs/lfs/lfs_subr.c |  14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diffs (71 lines):

diff -r b7fe1ab24c45 -r 3487a5f685e3 sys/ufs/lfs/lfs_subr.c
--- a/sys/ufs/lfs/lfs_subr.c    Thu Apr 06 03:00:13 2017 +0000
+++ b/sys/ufs/lfs/lfs_subr.c    Thu Apr 06 03:12:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_subr.c,v 1.90 2017/04/06 02:55:22 maya Exp $       */
+/*     $NetBSD: lfs_subr.c,v 1.91 2017/04/06 03:12:48 maya 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_subr.c,v 1.90 2017/04/06 02:55:22 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.91 2017/04/06 03:12:48 maya Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -188,7 +188,7 @@
 {
        struct lfs_res_blk *re;
        void *r;
-       int i, s, start;
+       int i, start;
        unsigned int h;
 
        ASSERT_MAYBE_SEGLOCK(fs);
@@ -224,9 +224,7 @@
                                r = re->p;
                                KASSERT(re->size >= size);
                                h = lfs_mhash(r);
-                               s = splbio();
                                LIST_INSERT_HEAD(&fs->lfs_reshash[h], re, res);
-                               splx(s);
                                mutex_exit(&lfs_lock);
                                return r;
                        }
@@ -246,32 +244,28 @@
 void
 lfs_free(struct lfs *fs, void *p, int type)
 {
-       int s;
        unsigned int h;
        res_t *re;
 
        ASSERT_MAYBE_SEGLOCK(fs);
        h = lfs_mhash(p);
        mutex_enter(&lfs_lock);
-       s = splbio();
        LIST_FOREACH(re, &fs->lfs_reshash[h], res) {
                if (re->p == p) {
                        KASSERT(re->inuse == 1);
                        LIST_REMOVE(re, res);
                        re->inuse = 0;
                        wakeup(&fs->lfs_resblk);
-                       splx(s);
                        mutex_exit(&lfs_lock);
                        return;
                }
        }
 
        for (int i = 0; i < LFS_N_TOTAL; i++) {
-               KDASSERTMSG(fs->lfs_resblk[i].p != p,
+               KDASSERTMSG(fs->lfs_resblk[i].p == p,
                    "lfs_free: inconsistent reserved block");
        }
 
-       splx(s);
        mutex_exit(&lfs_lock);
 
        /*



Home | Main Index | Thread Index | Old Index