Source-Changes-HG archive

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

[src/thorpej_scsipi]: src/sys/dev/ic Don't sleep waiting for a CCB; if we get...



details:   https://anonhg.NetBSD.org/src/rev/8dcd193c4f76
branches:  thorpej_scsipi
changeset: 477283:8dcd193c4f76
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Oct 19 22:39:40 1999 +0000

description:
Don't sleep waiting for a CCB; if we get to the CCB allocation phase, we're
guaranteed to have one.

diffstat:

 sys/dev/ic/bha.c |  36 +++++++-----------------------------
 1 files changed, 7 insertions(+), 29 deletions(-)

diffs (79 lines):

diff -r 4b72d47ee4af -r 8dcd193c4f76 sys/dev/ic/bha.c
--- a/sys/dev/ic/bha.c  Tue Oct 19 22:03:45 1999 +0000
+++ b/sys/dev/ic/bha.c  Tue Oct 19 22:39:40 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bha.c,v 1.33.2.1 1999/10/19 17:47:01 thorpej Exp $     */
+/*     $NetBSD: bha.c,v 1.33.2.2 1999/10/19 22:39:40 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -113,7 +113,7 @@
 struct bha_ccb *bha_ccb_phys_kv __P((struct bha_softc *, bus_addr_t));
 void   bha_create_ccbs __P((struct bha_softc *, int));
 int    bha_init_ccb __P((struct bha_softc *, struct bha_ccb *));
-struct bha_ccb *bha_get_ccb __P((struct bha_softc *, int));
+struct bha_ccb *bha_get_ccb __P((struct bha_softc *));
 void   bha_free_ccb __P((struct bha_softc *, struct bha_ccb *));
 
 #define BHA_RESET_TIMEOUT      2000    /* time to wait for reset (mSec) */
@@ -306,7 +306,7 @@
                flags = xs->xs_control;
 
                /* Get a CCB to use. */
-               ccb = bha_get_ccb(sc, flags);
+               ccb = bha_get_ccb(sc);
 #ifdef DIAGNOSTIC
                /*
                 * This should never happen as we track the resources
@@ -1922,29 +1922,16 @@
  *     wait until one becomes available, if we can.
  */
 struct bha_ccb *
-bha_get_ccb(sc, flags)
+bha_get_ccb(sc)
        struct bha_softc *sc;
-       int flags;
 {
        struct bha_ccb *ccb;
        int s;
 
        s = splbio();
-
-       for (;;) {
-               ccb = TAILQ_FIRST(&sc->sc_free_ccb);
-               if (ccb) {
-                       TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
-                       break;
-               }
-               if ((flags & XS_CTL_NOSLEEP) != 0)
-                       goto out;
-               tsleep(&sc->sc_free_ccb, PRIBIO, "bhaccb", 0);
-       }
-
-       ccb->flags |= CCB_ALLOC;
-
-out:
+       ccb = TAILQ_FIRST(&sc->sc_free_ccb);
+       if (ccb != NULL)
+               ccb->flags |= CCB_ALLOC;
        splx(s);
        return (ccb);
 }
@@ -1962,17 +1949,8 @@
        int s;
 
        s = splbio();
-
        bha_reset_ccb(ccb);
        TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, chain);
-
-       /*
-        * If there were none, wake anybody waiting for one to come free,
-        * starting with queued entries.
-        */
-       if (TAILQ_NEXT(ccb, chain) == NULL)
-               wakeup(&sc->sc_free_ccb);
-
        splx(s);
 }
 



Home | Main Index | Thread Index | Old Index