From: mk Date: Tue, 20 Jul 2010 20:46:18 +0000 (+0000) Subject: Use an SLIST rather than a TAILQ for the ccb free list. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7b8fdad42d1693e2a3faf8ba3aad5db1f3b30143;p=openbsd Use an SLIST rather than a TAILQ for the ccb free list. ok krw --- diff --git a/sys/dev/ic/dpt.c b/sys/dev/ic/dpt.c index 87aa0d21c77..87a46e54654 100644 --- a/sys/dev/ic/dpt.c +++ b/sys/dev/ic/dpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dpt.c,v 1.27 2010/07/20 20:43:27 mk Exp $ */ +/* $OpenBSD: dpt.c,v 1.28 2010/07/20 20:46:18 mk Exp $ */ /* $NetBSD: dpt.c,v 1.12 1999/10/23 16:26:33 ad Exp $ */ /*- @@ -315,7 +315,7 @@ dpt_init(sc, intrstr) sc->sc_statpack->sp_ccbid = -1; /* Initialize the CCBs */ - TAILQ_INIT(&sc->sc_free_ccb); + SLIST_INIT(&sc->sc_free_ccb); i = dpt_create_ccbs(sc, sc->sc_ccbs, sc->sc_nccbs); if (i == 0) { @@ -655,10 +655,8 @@ dpt_free_ccb(sc, ccb) s = splbio(); ccb->ccb_flg = 0; - TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, ccb_chain); - /* Wake anybody waiting for a free ccb */ - if (TAILQ_NEXT(ccb, ccb_chain) == NULL) + if (SLIST_NEXT(ccb, ccb_chain) == NULL) wakeup(&sc->sc_free_ccb); splx(s); } @@ -711,7 +709,7 @@ dpt_create_ccbs(sc, ccbstore, count) break; } ccb->ccb_id = i; - TAILQ_INSERT_TAIL(&sc->sc_free_ccb, ccb, ccb_chain); + SLIST_INSERT_HEAD(&sc->sc_free_ccb, ccb, ccb_chain); } return (i); @@ -733,9 +731,9 @@ dpt_alloc_ccb(sc, flg) s = splbio(); for (;;) { - ccb = TAILQ_FIRST(&sc->sc_free_ccb); + ccb = SLIST_FIRST(&sc->sc_free_ccb); if (ccb) { - TAILQ_REMOVE(&sc->sc_free_ccb, ccb, ccb_chain); + SLIST_REMOVE_HEAD(&sc->sc_free_ccb, ccb_chain); break; } #ifdef __NetBSD__ diff --git a/sys/dev/ic/dptvar.h b/sys/dev/ic/dptvar.h index ee59c092385..e09a1e951ad 100644 --- a/sys/dev/ic/dptvar.h +++ b/sys/dev/ic/dptvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dptvar.h,v 1.5 2010/03/23 01:57:19 krw Exp $ */ +/* $OpenBSD: dptvar.h,v 1.6 2010/07/20 20:46:18 mk Exp $ */ /* $NetBSD: dptvar.h,v 1.5 1999/10/23 16:26:32 ad Exp $ */ /* @@ -49,7 +49,7 @@ struct dpt_ccb { int ccb_hba_status; /* from status packet */ int ccb_scsi_status; /* from status packet */ int ccb_id; /* unique ID of this CCB */ - TAILQ_ENTRY(dpt_ccb) ccb_chain; /* link to next CCB */ + SLIST_ENTRY(dpt_ccb) ccb_chain; /* link to next CCB */ #ifdef __NetBSD__ struct scsipi_sense_data ccb_sense; /* SCSI sense data on error */ struct scsipi_xfer *ccb_xs; /* initiating SCSI command */ @@ -88,7 +88,7 @@ struct dpt_softc { int sc_hbaid[3]; /* ID of HBA on each channel */ int sc_nccbs; /* number of CCBs available */ int sc_open; /* device is open */ - TAILQ_HEAD(, dpt_ccb) sc_free_ccb;/* free ccb list */ + SLIST_HEAD(, dpt_ccb) sc_free_ccb;/* free ccb list */ }; int dpt_intr(void *);