diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/wd.c | 18 | ||||
-rw-r--r-- | sys/dev/flash.c | 10 | ||||
-rw-r--r-- | sys/dev/flashvar.h | 3 | ||||
-rw-r--r-- | sys/dev/vnd.c | 28 |
4 files changed, 33 insertions, 26 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index e6d9f45e2f6..b70a68ba61e 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.74 2009/06/03 22:09:30 thib Exp $ */ +/* $OpenBSD: wd.c,v 1.75 2009/06/17 01:30:30 thib Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -119,7 +119,7 @@ struct wd_softc { /* General disk infos */ struct device sc_dev; struct disk sc_dk; - + struct buf sc_q; /* IDE disk soft states */ struct ata_bio sc_wdc_bio; /* current transfer */ struct buf *sc_bp; /* buf being transferred */ @@ -396,12 +396,13 @@ int wddetach(struct device *self, int flags) { struct wd_softc *sc = (struct wd_softc *)self; - struct buf *bp; + struct buf *dp, *bp; int s, bmaj, cmaj, mn; /* Remove unprocessed buffers from queue */ s = splbio(); - while ((bp = BUFQ_GET(sc->sc_dk.dk_bufq)) != NULL) { + for (dp = &sc->sc_q; (bp = dp->b_actf) != NULL; ) { + dp->b_actf = bp->b_actf; bp->b_error = ENXIO; bp->b_flags |= B_ERROR; biodone(bp); @@ -474,7 +475,7 @@ wdstrategy(struct buf *bp) goto done; /* Queue transfer on drive, activate drive and controller if idle. */ s = splbio(); - BUFQ_ADD(wd->sc_dk.dk_bufq, bp); + disksort(&wd->sc_q, bp); wdstart(wd); splx(s); device_unref(&wd->sc_dev); @@ -498,15 +499,18 @@ void wdstart(void *arg) { struct wd_softc *wd = arg; - struct buf *bp = NULL; + struct buf *dp, *bp = NULL; WDCDEBUG_PRINT(("wdstart %s\n", wd->sc_dev.dv_xname), DEBUG_XFERS); while (wd->openings > 0) { /* Is there a buf for us ? */ - if ((bp = BUFQ_GET(wd->sc_dk.dk_bufq)) == NULL) + dp = &wd->sc_q; + if ((bp = dp->b_actf) == NULL) /* yes, an assign */ return; + dp->b_actf = bp->b_actf; + /* * Make the command. First lock the device */ diff --git a/sys/dev/flash.c b/sys/dev/flash.c index ea87e89ce61..3e04aa4a268 100644 --- a/sys/dev/flash.c +++ b/sys/dev/flash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flash.c,v 1.11 2009/06/04 23:13:21 deraadt Exp $ */ +/* $OpenBSD: flash.c,v 1.12 2009/06/17 01:30:30 thib Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org> @@ -814,7 +814,7 @@ flashstrategy(struct buf *bp) /* Queue the transfer. */ s = splbio(); - BUFQ_ADD(sc->sc_dk.dk_bufq, bp); + disksort(&sc->sc_q, bp); flashstart(sc); splx(s); device_unref(&sc->sc_dev); @@ -877,13 +877,15 @@ flashsize(dev_t dev) void flashstart(struct flash_softc *sc) { - struct buf *bp; + struct buf *dp, *bp; while (1) { /* Remove the next buffer from the queue or stop. */ - bp = BUFQ_GET(sc->sc_dk.dk_bufq); + dp = &sc->sc_q; + bp = dp->b_actf; if (bp == NULL) return; + dp->b_actf = bp->b_actf; /* Transfer this buffer now. */ _flashstart(sc, bp); diff --git a/sys/dev/flashvar.h b/sys/dev/flashvar.h index 0be3d979424..d6b150b4393 100644 --- a/sys/dev/flashvar.h +++ b/sys/dev/flashvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: flashvar.h,v 1.3 2009/06/03 22:09:30 thib Exp $ */ +/* $OpenBSD: flashvar.h,v 1.4 2009/06/17 01:30:30 thib Exp $ */ /* * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org> @@ -77,6 +77,7 @@ struct flash_softc { struct device sc_dev; /* Disk device information */ struct disk sc_dk; + struct buf sc_q; struct buf *sc_bp; int sc_flags; /* Flash controller tag */ diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 8cbda77ef91..43c78122563 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vnd.c,v 1.92 2009/06/04 05:57:27 krw Exp $ */ +/* $OpenBSD: vnd.c,v 1.93 2009/06/17 01:30:30 thib Exp $ */ /* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */ /* @@ -125,7 +125,6 @@ struct pool vndbufpl; struct vnd_softc { struct device sc_dev; struct disk sc_dk; - int sc_active; /* XXX */ char sc_file[VNDNLEN]; /* file we're covering */ int sc_flags; /* flags */ @@ -135,6 +134,7 @@ struct vnd_softc { size_t sc_ntracks; /* # of tracks per cylinder */ struct vnode *sc_vp; /* vnode */ struct ucred *sc_cred; /* credentials */ + struct buf sc_tab; /* transfer queue */ blf_ctx *sc_keyctx; /* key context */ struct rwlock sc_rwlock; }; @@ -499,8 +499,8 @@ vndstrategy(struct buf *bp) biodone(bp); splx(s); - /* If nothing more is queued, we are done. */ - if (!vnd->sc_active) + /* If nothing more is queued, we are done. */ + if (!vnd->sc_tab.b_active) return; /* @@ -508,8 +508,9 @@ vndstrategy(struct buf *bp) * routine might queue using same links. */ s = splbio(); - bp = BUFQ_GET(vnd->sc_dk.dk_bufq); - vnd->sc_active--; + bp = vnd->sc_tab.b_actf; + vnd->sc_tab.b_actf = bp->b_actf; + vnd->sc_tab.b_active--; splx(s); } } @@ -609,8 +610,8 @@ vndstrategy(struct buf *bp) */ nbp->vb_buf.b_cylinder = nbp->vb_buf.b_blkno; s = splbio(); - BUFQ_ADD(vnd->sc_dk.dk_bufq, &nbp->vb_buf); - vnd->sc_active++; + disksort(&vnd->sc_tab, &nbp->vb_buf); + vnd->sc_tab.b_active++; vndstart(vnd); splx(s); bn += sz; @@ -633,9 +634,8 @@ vndstart(struct vnd_softc *vnd) * Dequeue now since lower level strategy routine might * queue using same links */ - bp = BUFQ_GET(vnd->sc_dk.dk_bufq); - if (bp == NULL) - return; + bp = vnd->sc_tab.b_actf; + vnd->sc_tab.b_actf = bp->b_actf; DNPRINTF(VDB_IO, "vndstart(%d): bp %p vp %p blkno %x addr %p cnt %lx\n", @@ -675,11 +675,11 @@ vndiodone(struct buf *bp) } pbp->b_resid -= vbp->vb_buf.b_bcount; putvndbuf(vbp); - if (vnd->sc_active) { + if (vnd->sc_tab.b_active) { disk_unbusy(&vnd->sc_dk, (pbp->b_bcount - pbp->b_resid), (pbp->b_flags & B_READ)); - if (BUFQ_PEEK(vnd->sc_dk.dk_bufq) != NULL) - vnd->sc_active--; + if (!vnd->sc_tab.b_actf) + vnd->sc_tab.b_active--; } if (pbp->b_resid == 0) { DNPRINTF(VDB_IO, "vndiodone: pbp %p iodone\n", pbp); |