diff --git a/sys/arch/acorn32/mainbus/fd.c b/sys/arch/acorn32/mainbus/fd.c index 6850ecced5d1..e189cccbcf12 100644 --- a/sys/arch/acorn32/mainbus/fd.c +++ b/sys/arch/acorn32/mainbus/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.11 2002/10/23 09:10:27 jdolecek Exp $ */ +/* $NetBSD: fd.c,v 1.12 2002/11/01 11:31:50 mrg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -1136,7 +1136,8 @@ loop: return 1; case SEEKCOMPLETE: - disk_unbusy(&fd->sc_dk, 0); /* no data on seek */ + /* no data on seek */ + disk_unbusy(&fd->sc_dk, 0, 0); /* Make sure seek really happened. */ out_fdc(iot, ioh, NE7CMD_SENSEI); @@ -1163,7 +1164,8 @@ loop: case IOCOMPLETE: /* IO DONE, post-analyze */ callout_stop(&fdc->sc_timo_ch); - disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); if (fdcresult(fdc) != 7 || (st0 & 0xf8) != 0) { fiq_release(&fdc->sc_fh); diff --git a/sys/arch/amiga/dev/fd.c b/sys/arch/amiga/dev/fd.c index e35a12a819eb..6d1a9754d45f 100644 --- a/sys/arch/amiga/dev/fd.c +++ b/sys/arch/amiga/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.55 2002/10/23 09:10:31 jdolecek Exp $ */ +/* $NetBSD: fd.c,v 1.56 2002/11/01 11:31:51 mrg Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.55 2002/10/23 09:10:31 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.56 2002/11/01 11:31:51 mrg Exp $"); #include #include @@ -1577,7 +1577,8 @@ fddone(struct fd_softc *sc) */ (void)BUFQ_GET(&sc->bufq); - disk_unbusy(&sc->dkdev, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&sc->dkdev, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); biodone(bp); nobuf: diff --git a/sys/arch/arc/jazz/fd.c b/sys/arch/arc/jazz/fd.c index be693193024d..083c2c65bf8a 100644 --- a/sys/arch/arc/jazz/fd.c +++ b/sys/arch/arc/jazz/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.8 2002/10/23 09:10:40 jdolecek Exp $ */ +/* $NetBSD: fd.c,v 1.9 2002/11/01 11:31:51 mrg Exp $ */ /* $OpenBSD: fd.c,v 1.6 1998/10/03 21:18:57 millert Exp $ */ /* NetBSD: fd.c,v 1.78 1995/07/04 07:23:09 mycroft Exp */ @@ -937,7 +937,7 @@ loop: return 1; case SEEKCOMPLETE: - disk_unbusy(&fd->sc_dk, 0); + disk_unbusy(&fd->sc_dk, 0, 0); /* Make sure seek really happened. */ out_fdc(iot, ioh, NE7CMD_SENSEI); @@ -964,7 +964,8 @@ loop: case IOCOMPLETE: /* IO DONE, post-analyze */ callout_stop(&fdc->sc_timo_ch); - disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); i = fdcresult(fdc); if (i != 7 || (st0 & 0xf8) != 0) { diff --git a/sys/arch/atari/dev/fd.c b/sys/arch/atari/dev/fd.c index f15150da75a4..dcd6d8eeeea8 100644 --- a/sys/arch/atari/dev/fd.c +++ b/sys/arch/atari/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.43 2002/10/23 09:10:50 jdolecek Exp $ */ +/* $NetBSD: fd.c,v 1.44 2002/11/01 11:31:52 mrg Exp $ */ /* * Copyright (c) 1995 Leo Weppelman. @@ -743,7 +743,8 @@ register struct fd_softc *sc; #endif bp->b_resid = sc->io_bytes; - disk_unbusy(&sc->dkdev, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&sc->dkdev, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); biodone(bp); } diff --git a/sys/arch/atari/dev/hdfd.c b/sys/arch/atari/dev/hdfd.c index 7b7c7fba7198..a25d88b04217 100644 --- a/sys/arch/atari/dev/hdfd.c +++ b/sys/arch/atari/dev/hdfd.c @@ -1,4 +1,4 @@ -/* $NetBSD: hdfd.c,v 1.34 2002/10/23 09:10:51 jdolecek Exp $ */ +/* $NetBSD: hdfd.c,v 1.35 2002/11/01 11:31:52 mrg Exp $ */ /*- * Copyright (c) 1996 Leo Weppelman @@ -1108,7 +1108,8 @@ loop: return 1; case SEEKCOMPLETE: - disk_unbusy(&fd->sc_dk, 0); /* no data on seek */ + /* no data on seek */ + disk_unbusy(&fd->sc_dk, 0, 0); /* Make sure seek really happened. */ out_fdc(NE7CMD_SENSEI); @@ -1133,7 +1134,8 @@ loop: case IOCOMPLETE: /* IO DONE, post-analyze */ callout_stop(&fdc->sc_timo_ch); - disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); if (fdcresult(fdc) != 7 || (st1 & 0x37) != 0) { /* diff --git a/sys/arch/hp300/dev/rd.c b/sys/arch/hp300/dev/rd.c index e65b58f13a26..a0c5c43114ad 100644 --- a/sys/arch/hp300/dev/rd.c +++ b/sys/arch/hp300/dev/rd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.54 2002/10/23 09:11:08 jdolecek Exp $ */ +/* $NetBSD: rd.c,v 1.55 2002/11/01 11:31:52 mrg Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -83,7 +83,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.54 2002/10/23 09:11:08 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.55 2002/11/01 11:31:52 mrg Exp $"); #include "opt_useleds.h" #include "rnd.h" @@ -911,7 +911,8 @@ rdintr(arg) return; } #endif - disk_unbusy(&rs->sc_dkdev, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&rs->sc_dkdev, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); if (rs->sc_flags & RDF_SEEK) { rs->sc_flags &= ~RDF_SEEK; diff --git a/sys/arch/hp300/dev/sd.c b/sys/arch/hp300/dev/sd.c index 13524be30801..7eb0a7798f5c 100644 --- a/sys/arch/hp300/dev/sd.c +++ b/sys/arch/hp300/dev/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.56 2002/10/23 09:11:09 jdolecek Exp $ */ +/* $NetBSD: sd.c,v 1.57 2002/11/01 11:31:53 mrg Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.56 2002/10/23 09:11:09 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.57 2002/11/01 11:31:53 mrg Exp $"); #include "rnd.h" #include "opt_useleds.h" @@ -993,7 +993,8 @@ sdintr(arg, stat) return; } - disk_unbusy(&sc->sc_dkdev, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&sc->sc_dkdev, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); if (stat) { #ifdef DEBUG diff --git a/sys/arch/mac68k/obio/iwm_fd.c b/sys/arch/mac68k/obio/iwm_fd.c index 082ce0169d2a..949cf5d4c916 100644 --- a/sys/arch/mac68k/obio/iwm_fd.c +++ b/sys/arch/mac68k/obio/iwm_fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: iwm_fd.c,v 1.18 2002/10/23 09:11:30 jdolecek Exp $ */ +/* $NetBSD: iwm_fd.c,v 1.19 2002/11/01 11:31:53 mrg Exp $ */ /* * Copyright (c) 1997, 1998 Hauke Fath. All rights reserved. @@ -1637,7 +1637,8 @@ fdstart_Exit(fd) if (DISABLED && TRACE_STRAT) printf(" Next buf (bufQueue first) at %p\n", BUFQ_PEEK(&fd->bufQueue)); - disk_unbusy(&fd->diskInfo, bp->b_bcount - bp->b_resid); + disk_unbusy(&fd->diskInfo, bp->b_bcount - bp->b_resid, + (bp->b_flags & B_READ)); biodone(bp); /* * Stop motor after 10s diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c index 074ee79f820c..43384c2f185b 100644 --- a/sys/arch/sparc/dev/fd.c +++ b/sys/arch/sparc/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.95 2002/10/23 09:12:08 jdolecek Exp $ */ +/* $NetBSD: fd.c,v 1.96 2002/11/01 11:31:53 mrg Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -1606,7 +1606,8 @@ loop: } /*FALLTHROUGH*/ case SEEKCOMPLETE: - disk_unbusy(&fd->sc_dk, 0); /* no data on seek */ + /* no data on seek */ + disk_unbusy(&fd->sc_dk, 0, 0); /* Make sure seek really happened. */ if (fdc->sc_nstat != 2 || (st0 & 0xf8) != 0x20 || @@ -1650,14 +1651,16 @@ loop: case IOCLEANUPWAIT: /* IO FAILED, cleanup succeeded */ callout_stop(&fdc->sc_timo_ch); - disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); fdcretry(fdc); goto loop; case IOCOMPLETE: /* IO DONE, post-analyze */ callout_stop(&fdc->sc_timo_ch); - disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); if (fdc->sc_nstat != 7 || st1 != 0 || ((st0 & 0xf8) != 0 && diff --git a/sys/arch/sun3/dev/fd.c b/sys/arch/sun3/dev/fd.c index b4151309cdaa..f2c6524739f5 100644 --- a/sys/arch/sun3/dev/fd.c +++ b/sys/arch/sun3/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.32 2002/10/23 09:12:26 jdolecek Exp $ */ +/* $NetBSD: fd.c,v 1.33 2002/11/01 11:31:54 mrg Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. @@ -1321,7 +1321,8 @@ loop: } /*FALLTHROUGH*/ case SEEKCOMPLETE: - disk_unbusy(&fd->sc_dk, 0); /* no data on seek */ + /* no data on seek */ + disk_unbusy(&fd->sc_dk, 0, 0); /* Make sure seek really happened. */ if (fdc->sc_nstat != 2 || (st0 & 0xf8) != 0x20 || @@ -1353,7 +1354,8 @@ loop: case IOCOMPLETE: /* IO DONE, post-analyze */ callout_stop(&fdc->sc_timo_ch); - disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); if (fdc->sc_nstat != 7 || (st0 & 0xf8) != 0 || st1 != 0) { #ifdef FD_DEBUG diff --git a/sys/arch/sun3/dev/xd.c b/sys/arch/sun3/dev/xd.c index 267ea6e57f04..434520bb9c5e 100644 --- a/sys/arch/sun3/dev/xd.c +++ b/sys/arch/sun3/dev/xd.c @@ -1,4 +1,4 @@ -/* $NetBSD: xd.c,v 1.40 2002/10/23 09:12:27 jdolecek Exp $ */ +/* $NetBSD: xd.c,v 1.41 2002/11/01 11:31:54 mrg Exp $ */ /* * @@ -1725,7 +1725,8 @@ xdc_reset(xdcsc, quiet, blastmode, error, xdsc) dvma_mapout(iorq->dbufbase, iorq->buf->b_bcount); disk_unbusy(&iorq->xd->sc_dk, - (iorq->buf->b_bcount - iorq->buf->b_resid)); + (iorq->buf->b_bcount - iorq->buf->b_resid), + (iorq->buf->b_flags & B_READ)); biodone(iorq->buf); XDC_FREE(xdcsc, lcv); /* add to free list */ break; @@ -1930,7 +1931,8 @@ xdc_remove_iorq(xdcsc) dvma_mapout(iorq->dbufbase, iorq->buf->b_bcount); disk_unbusy(&iorq->xd->sc_dk, - (bp->b_bcount - bp->b_resid)); + (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); XDC_FREE(xdcsc, rqno); biodone(bp); break; diff --git a/sys/arch/sun3/dev/xy.c b/sys/arch/sun3/dev/xy.c index 5ec0373053eb..3d4f9e59be94 100644 --- a/sys/arch/sun3/dev/xy.c +++ b/sys/arch/sun3/dev/xy.c @@ -1,4 +1,4 @@ -/* $NetBSD: xy.c,v 1.42 2002/10/23 09:12:29 jdolecek Exp $ */ +/* $NetBSD: xy.c,v 1.43 2002/11/01 11:31:54 mrg Exp $ */ /* * @@ -1659,8 +1659,8 @@ xyc_reset(xycsc, quiet, blastmode, error, xysc) iorq->buf->b_bcount); (void)BUFQ_GET(&iorq->xy->xyq); disk_unbusy(&iorq->xy->sc_dk, - (iorq->buf->b_bcount - - iorq->buf->b_resid)); + (iorq->buf->b_bcount - iorq->buf->b_resid), + (iorq->buf->b_flags & B_READ)); biodone(iorq->buf); iorq->mode = XY_SUB_FREE; break; @@ -1837,7 +1837,8 @@ xyc_remove_iorq(xycsc) iorq->buf->b_bcount); (void)BUFQ_GET(&iorq->xy->xyq); disk_unbusy(&iorq->xy->sc_dk, - (bp->b_bcount - bp->b_resid)); + (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); iorq->mode = XY_SUB_FREE; biodone(bp); break; diff --git a/sys/arch/vax/mba/hp.c b/sys/arch/vax/mba/hp.c index ff20fc7d5007..addb3b97f1f8 100644 --- a/sys/arch/vax/mba/hp.c +++ b/sys/arch/vax/mba/hp.c @@ -1,4 +1,4 @@ -/* $NetBSD: hp.c,v 1.30 2002/10/23 09:12:33 jdolecek Exp $ */ +/* $NetBSD: hp.c,v 1.31 2002/11/01 11:31:55 mrg Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -401,7 +401,8 @@ hper2: sc->sc_dev.dv_xname, mbasr); BUFQ_PEEK(&md->md_q)->b_resid = 0; - disk_unbusy(&sc->sc_disk, BUFQ_PEEK(&md->md_q)->b_bcount); + disk_unbusy(&sc->sc_disk, BUFQ_PEEK(&md->md_q)->b_bcount, + (bp->b_flags & B_READ)); return XFER_FINISH; } diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index c57e67c82028..b47bc7a8ff6d 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.231 2002/10/23 09:13:07 jdolecek Exp $ */ +/* $NetBSD: wd.c,v 1.232 2002/11/01 11:31:56 mrg Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.231 2002/10/23 09:13:07 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.232 2002/11/01 11:31:56 mrg Exp $"); #ifndef WDCDEBUG #define WDCDEBUG @@ -655,7 +655,8 @@ noerror: if ((wd->sc_wdc_bio.flags & ATA_CORR) || wd->retries > 0) bp->b_error = EIO; break; } - disk_unbusy(&wd->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&wd->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); #if NRND > 0 rnd_add_uint32(&wd->rnd_source, bp->b_blkno); #endif diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c index 85e91ecf3227..34f2c3eb9d79 100644 --- a/sys/dev/ccd.c +++ b/sys/dev/ccd.c @@ -1,4 +1,4 @@ -/* $NetBSD: ccd.c,v 1.79 2002/10/23 09:12:59 jdolecek Exp $ */ +/* $NetBSD: ccd.c,v 1.80 2002/11/01 11:31:55 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 1999 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.79 2002/10/23 09:12:59 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.80 2002/11/01 11:31:55 mrg Exp $"); #include #include @@ -712,7 +712,7 @@ ccdstart(cs, bp) bp->b_error = ENOMEM; bp->b_flags |= B_ERROR; biodone(bp); - disk_unbusy(&cs->sc_dkdev, 0); + disk_unbusy(&cs->sc_dkdev, 0, 0); return; } SIMPLEQ_INSERT_TAIL(&cbufq, cbp, cb_q); @@ -849,7 +849,8 @@ ccdintr(cs, bp) */ if (bp->b_flags & B_ERROR) bp->b_resid = bp->b_bcount; - disk_unbusy(&cs->sc_dkdev, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&cs->sc_dkdev, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); biodone(bp); } diff --git a/sys/dev/cgd.c b/sys/dev/cgd.c index 4092093e31e2..d38ea15d5876 100644 --- a/sys/dev/cgd.c +++ b/sys/dev/cgd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cgd.c,v 1.4 2002/10/24 08:04:00 jdolecek Exp $ */ +/* $NetBSD: cgd.c,v 1.5 2002/11/01 11:31:55 mrg Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.4 2002/10/24 08:04:00 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.5 2002/11/01 11:31:55 mrg Exp $"); #include #include @@ -304,7 +304,7 @@ cgdstart(struct dk_softc *dksc, struct buf *bp) if (newaddr != addr) free(newaddr, M_DEVBUF); biodone(bp); - disk_unbusy(&dksc->sc_dkdev, 0); + disk_unbusy(&dksc->sc_dkdev, 0, (bp->b_flags & B_READ)); return; } cbp->cb_buf.b_data = newaddr; @@ -372,7 +372,8 @@ cgdiodone(struct buf *vbp) obp->b_resid = 0; if (obp->b_flags & B_ERROR) obp->b_resid = obp->b_bcount; - disk_unbusy(&dksc->sc_dkdev, obp->b_bcount - obp->b_resid); + disk_unbusy(&dksc->sc_dkdev, obp->b_bcount - obp->b_resid, + (obp->b_flags & B_READ)); biodone(obp); splx(s); } diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c index dba87c5dc468..b6225c4dbcac 100644 --- a/sys/dev/isa/fd.c +++ b/sys/dev/isa/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.30 2002/10/23 09:13:22 jdolecek Exp $ */ +/* $NetBSD: fd.c,v 1.31 2002/11/01 11:31:57 mrg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -92,7 +92,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.30 2002/10/23 09:13:22 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.31 2002/11/01 11:31:57 mrg Exp $"); #include "rnd.h" #include "opt_ddb.h" @@ -1132,7 +1132,8 @@ loop: return 1; case SEEKCOMPLETE: - disk_unbusy(&fd->sc_dk, 0); /* no data on seek */ + /* no data on seek */ + disk_unbusy(&fd->sc_dk, 0, 0); /* Make sure seek really happened. */ out_fdc(iot, ioh, NE7CMD_SENSEI); @@ -1158,7 +1159,8 @@ loop: case IOCOMPLETE: /* IO DONE, post-analyze */ callout_stop(&fdc->sc_timo_ch); - disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&fd->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); if (fdcresult(fdc) != 7 || (st0 & 0xf8) != 0) { isa_dmaabort(fdc->sc_ic, fdc->sc_drq); diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c index f9313f337fcc..08d5117229d0 100644 --- a/sys/dev/isa/mcd.c +++ b/sys/dev/isa/mcd.c @@ -1,4 +1,4 @@ -/* $NetBSD: mcd.c,v 1.80 2002/10/23 09:13:23 jdolecek Exp $ */ +/* $NetBSD: mcd.c,v 1.81 2002/11/01 11:31:57 mrg Exp $ */ /* * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -56,7 +56,7 @@ /*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/ #include -__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.80 2002/10/23 09:13:23 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.81 2002/11/01 11:31:57 mrg Exp $"); #include #include @@ -1324,7 +1324,7 @@ mcdintr(arg) /* Return buffer. */ bp->b_resid = 0; - disk_unbusy(&sc->sc_dk, bp->b_bcount); + disk_unbusy(&sc->sc_dk, bp->b_bcount, (bp->b_flags & B_READ)); biodone(bp); mcdstart(sc); @@ -1357,7 +1357,8 @@ changed: /* Invalidate the buffer. */ bp->b_flags |= B_ERROR; bp->b_resid = bp->b_bcount - mbx->skip; - disk_unbusy(&sc->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&sc->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); biodone(bp); mcdstart(sc); diff --git a/sys/dev/ld.c b/sys/dev/ld.c index c4b2ece052d8..fdb0d87eabdb 100644 --- a/sys/dev/ld.c +++ b/sys/dev/ld.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld.c,v 1.17 2002/10/23 09:13:02 jdolecek Exp $ */ +/* $NetBSD: ld.c,v 1.18 2002/11/01 11:31:56 mrg Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.17 2002/10/23 09:13:02 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.18 2002/11/01 11:31:56 mrg Exp $"); #include "rnd.h" @@ -552,7 +552,8 @@ lddone(struct ld_softc *sc, struct buf *bp) printf("\n"); } - disk_unbusy(&sc->sc_dk, bp->b_bcount - bp->b_resid); + disk_unbusy(&sc->sc_dk, bp->b_bcount - bp->b_resid, + (bp->b_flags & B_READ)); #if NRND > 0 rnd_add_uint32(&sc->sc_rnd_source, bp->b_rawblkno); #endif diff --git a/sys/dev/mca/edc_mca.c b/sys/dev/mca/edc_mca.c index 3c54806bc6e5..6e839c1859ee 100644 --- a/sys/dev/mca/edc_mca.c +++ b/sys/dev/mca/edc_mca.c @@ -1,4 +1,4 @@ -/* $NetBSD: edc_mca.c,v 1.20 2002/10/02 16:34:07 thorpej Exp $ */ +/* $NetBSD: edc_mca.c,v 1.21 2002/11/01 11:31:58 mrg Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.20 2002/10/02 16:34:07 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.21 2002/11/01 11:31:58 mrg Exp $"); #include "rnd.h" @@ -875,7 +875,8 @@ edcworker(arg) bp->b_resid = sc->sc_resblk * DEV_BSIZE; } - disk_unbusy(&ed->sc_dk, (bp->b_bcount - bp->b_resid)); + disk_unbusy(&ed->sc_dk, (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); #if NRND > 0 rnd_add_uint32(&ed->rnd_source, bp->b_blkno); #endif diff --git a/sys/dev/mscp/mscp_disk.c b/sys/dev/mscp/mscp_disk.c index 5804fdba849f..bb2e5b241dfb 100644 --- a/sys/dev/mscp/mscp_disk.c +++ b/sys/dev/mscp/mscp_disk.c @@ -1,4 +1,4 @@ -/* $NetBSD: mscp_disk.c,v 1.37 2002/10/23 09:13:27 jdolecek Exp $ */ +/* $NetBSD: mscp_disk.c,v 1.38 2002/11/01 11:31:58 mrg Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1988 Regents of the University of California. @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.37 2002/10/23 09:13:27 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.38 2002/11/01 11:31:58 mrg Exp $"); #include #include @@ -869,7 +869,7 @@ rriodone(usc, bp) already have verified it. Thus, no checks here... /bqt */ unit = DISKUNIT(bp->b_dev); ra = ra_cd.cd_devs[unit]; - disk_unbusy(&ra->ra_disk, bp->b_bcount); + disk_unbusy(&ra->ra_disk, bp->b_bcount, (bp->b_flags & B_READ)); biodone(bp); } diff --git a/sys/dev/ofw/ofdisk.c b/sys/dev/ofw/ofdisk.c index 4c6485090628..a515b588a4e7 100644 --- a/sys/dev/ofw/ofdisk.c +++ b/sys/dev/ofw/ofdisk.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofdisk.c,v 1.24 2002/10/23 09:13:29 jdolecek Exp $ */ +/* $NetBSD: ofdisk.c,v 1.25 2002/11/01 11:31:58 mrg Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.24 2002/10/23 09:13:29 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.25 2002/11/01 11:31:58 mrg Exp $"); #include #include @@ -276,7 +276,8 @@ ofdisk_strategy(struct buf *bp) } else bp->b_resid = bp->b_bcount - read; - disk_unbusy(&of->sc_dk, bp->b_bcount - bp->b_resid); + disk_unbusy(&of->sc_dk, bp->b_bcount - bp->b_resid, + (bp->b_flags & B_READ)); done: biodone(bp); diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index ca6ee6cd7836..4ed607a67bb0 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.144 2002/10/23 09:13:40 jdolecek Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.145 2002/11/01 11:31:59 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -114,7 +114,7 @@ ***********************************************************/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.144 2002/10/23 09:13:40 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.145 2002/11/01 11:31:59 mrg Exp $"); #include #include @@ -3373,5 +3373,5 @@ rf_disk_unbusy(desc) bp = (struct buf *)desc->bp; disk_unbusy(&raid_softc[desc->raidPtr->raidid].sc_dkdev, - (bp->b_bcount - bp->b_resid)); + (bp->b_bcount - bp->b_resid), (bp->b_flags & B_READ)); } diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c index 703aa8c8f8b9..c40759882f2a 100644 --- a/sys/dev/scsipi/cd.c +++ b/sys/dev/scsipi/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.168 2002/10/23 09:13:44 jdolecek Exp $ */ +/* $NetBSD: cd.c,v 1.169 2002/11/01 11:31:59 mrg Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.168 2002/10/23 09:13:44 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.169 2002/11/01 11:31:59 mrg Exp $"); #include "rnd.h" @@ -826,7 +826,7 @@ cdstart(periph) (u_char *)bp->b_data, bp->b_bcount, CDRETRIES, 30000, bp, flags); if (error) { - disk_unbusy(&cd->sc_dk, 0); + disk_unbusy(&cd->sc_dk, 0, 0); printf("%s: not queued, error %d\n", cd->sc_dev.dv_xname, error); } @@ -840,7 +840,8 @@ cddone(xs) struct cd_softc *cd = (void *)xs->xs_periph->periph_dev; if (xs->bp != NULL) { - disk_unbusy(&cd->sc_dk, xs->bp->b_bcount - xs->bp->b_resid); + disk_unbusy(&cd->sc_dk, xs->bp->b_bcount - xs->bp->b_resid, + (xs->bp->b_flags & B_READ));; #if NRND > 0 rnd_add_uint32(&cd->rnd_source, xs->bp->b_rawblkno); #endif diff --git a/sys/dev/scsipi/sd.c b/sys/dev/scsipi/sd.c index aec49c442d44..c7ab45801893 100644 --- a/sys/dev/scsipi/sd.c +++ b/sys/dev/scsipi/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.190 2002/10/23 09:13:48 jdolecek Exp $ */ +/* $NetBSD: sd.c,v 1.191 2002/11/01 11:32:00 mrg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.190 2002/10/23 09:13:48 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.191 2002/11/01 11:32:00 mrg Exp $"); #include "opt_scsi.h" #include "opt_bufq.h" @@ -816,7 +816,7 @@ sdstart(periph) (u_char *)bp->b_data, bp->b_bcount, SDRETRIES, SD_IO_TIMEOUT, bp, flags); if (error) { - disk_unbusy(&sd->sc_dk, 0); + disk_unbusy(&sd->sc_dk, 0, 0); printf("%s: not queued, error %d\n", sd->sc_dev.dv_xname, error); } @@ -835,7 +835,8 @@ sddone(xs) } if (xs->bp != NULL) { - disk_unbusy(&sd->sc_dk, xs->bp->b_bcount - xs->bp->b_resid); + disk_unbusy(&sd->sc_dk, xs->bp->b_bcount - xs->bp->b_resid, + (xs->bp->b_flags & B_READ)); #if NRND > 0 rnd_add_uint32(&sd->rnd_source, xs->bp->b_rawblkno); #endif diff --git a/sys/dev/vme/xd.c b/sys/dev/vme/xd.c index 281a1796b247..b44b4b17bed1 100644 --- a/sys/dev/vme/xd.c +++ b/sys/dev/vme/xd.c @@ -1,4 +1,4 @@ -/* $NetBSD: xd.c,v 1.46 2002/10/23 09:14:04 jdolecek Exp $ */ +/* $NetBSD: xd.c,v 1.47 2002/11/01 11:32:00 mrg Exp $ */ /* * @@ -51,7 +51,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.46 2002/10/23 09:14:04 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xd.c,v 1.47 2002/11/01 11:32:00 mrg Exp $"); #undef XDC_DEBUG /* full debug */ #define XDC_DIAG /* extra sanity checks */ @@ -1936,7 +1936,8 @@ xdc_reset(xdcsc, quiet, blastmode, error, xdsc) disk_unbusy(&xdcsc->reqs[lcv].xd->sc_dk, (xdcsc->reqs[lcv].buf->b_bcount - - xdcsc->reqs[lcv].buf->b_resid)); + xdcsc->reqs[lcv].buf->b_resid), + (iorq->buf->b_flags & B_READ)); biodone(iorq->buf); XDC_FREE(xdcsc, lcv); /* add to free list */ break; @@ -2145,7 +2146,8 @@ xdc_remove_iorq(xdcsc) bus_dmamap_unload(xdcsc->dmatag, iorq->dmamap); disk_unbusy(&iorq->xd->sc_dk, - (bp->b_bcount - bp->b_resid)); + (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); XDC_FREE(xdcsc, rqno); biodone(bp); break; diff --git a/sys/dev/vme/xy.c b/sys/dev/vme/xy.c index 0cd0ca25fb23..64f23a4e5b2a 100644 --- a/sys/dev/vme/xy.c +++ b/sys/dev/vme/xy.c @@ -1,4 +1,4 @@ -/* $NetBSD: xy.c,v 1.46 2002/10/23 09:14:05 jdolecek Exp $ */ +/* $NetBSD: xy.c,v 1.47 2002/11/01 11:32:01 mrg Exp $ */ /* * @@ -51,7 +51,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.46 2002/10/23 09:14:05 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xy.c,v 1.47 2002/11/01 11:32:01 mrg Exp $"); #undef XYC_DEBUG /* full debug */ #undef XYC_DIAG /* extra sanity checks */ @@ -1841,7 +1841,8 @@ xyc_reset(xycsc, quiet, blastmode, error, xysc) (void)BUFQ_GET(&iorq->xy->xyq); disk_unbusy(&xycsc->reqs[lcv].xy->sc_dk, (xycsc->reqs[lcv].buf->b_bcount - - xycsc->reqs[lcv].buf->b_resid)); + xycsc->reqs[lcv].buf->b_resid), + (xycsc->reqs[lcv].buf->b_flags & B_READ)); biodone(iorq->buf); iorq->mode = XY_SUB_FREE; break; @@ -2023,7 +2024,8 @@ xyc_remove_iorq(xycsc) (void)BUFQ_GET(&iorq->xy->xyq); disk_unbusy(&iorq->xy->sc_dk, - (bp->b_bcount - bp->b_resid)); + (bp->b_bcount - bp->b_resid), + (bp->b_flags & B_READ)); iorq->mode = XY_SUB_FREE; biodone(bp); break; diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c index 9f0b8d06dc71..50d48f43d1f8 100644 --- a/sys/dev/vnd.c +++ b/sys/dev/vnd.c @@ -1,4 +1,4 @@ -/* $NetBSD: vnd.c,v 1.87 2002/10/23 09:13:05 jdolecek Exp $ */ +/* $NetBSD: vnd.c,v 1.88 2002/11/01 11:31:56 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -98,7 +98,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.87 2002/10/23 09:13:05 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.88 2002/11/01 11:31:56 mrg Exp $"); #if defined(_KERNEL_OPT) #include "fs_nfs.h" @@ -592,7 +592,7 @@ vndiodone(bp) resid = vbp->vb_buf.b_bcount - vbp->vb_buf.b_resid; pbp->b_resid -= resid; - disk_unbusy(&vnd->sc_dkdev, resid); + disk_unbusy(&vnd->sc_dkdev, resid, (pbp->b_flags & B_READ)); vnx->vx_pending--; if (vbp->vb_buf.b_error) { diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 4037593e96a9..fbae9bbeb1b4 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $NetBSD: subr_disk.c,v 1.44 2002/11/01 03:34:07 enami Exp $ */ +/* $NetBSD: subr_disk.c,v 1.45 2002/11/01 11:32:01 mrg Exp $ */ /*- * Copyright (c) 1996, 1997, 1999, 2000 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.44 2002/11/01 03:34:07 enami Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.45 2002/11/01 11:32:01 mrg Exp $"); #include #include @@ -286,7 +286,7 @@ disk_busy(struct disk *diskp) * time, and reset the timestamp. */ void -disk_unbusy(struct disk *diskp, long bcount) +disk_unbusy(struct disk *diskp, long bcount, int read) { int s; struct timeval dv_time, diff_time; @@ -305,8 +305,13 @@ disk_unbusy(struct disk *diskp, long bcount) diskp->dk_timestamp = dv_time; if (bcount > 0) { - diskp->dk_bytes += bcount; - diskp->dk_xfer++; + if (read) { + diskp->dk_rbytes += bcount; + diskp->dk_rxfer++; + } else { + diskp->dk_wbytes += bcount; + diskp->dk_wxfer++; + } } } @@ -321,8 +326,10 @@ disk_resetstat(struct disk *diskp) { int s = splbio(), t; - diskp->dk_xfer = 0; - diskp->dk_bytes = 0; + diskp->dk_rxfer = 0; + diskp->dk_rbytes = 0; + diskp->dk_wxfer = 0; + diskp->dk_wbytes = 0; t = splclock(); diskp->dk_attachtime = mono_time; @@ -390,7 +397,7 @@ sysctl_diskstats(int *name, u_int namelen, void *vwhere, size_t *sizep) int error; if (where == NULL) { - *sizep = disk_count * sizeof(struct disk_sysctl); + *sizep = disk_count * sizeof(sdisk); return (0); } @@ -409,9 +416,13 @@ sysctl_diskstats(int *name, u_int namelen, void *vwhere, size_t *sizep) if (left < sizeof(struct disk_sysctl)) break; strncpy(sdisk.dk_name, diskp->dk_name, sizeof(sdisk.dk_name)); - sdisk.dk_xfer = diskp->dk_xfer; + sdisk.dk_xfer = diskp->dk_rxfer + diskp->dk_wxfer; + sdisk.dk_rxfer = diskp->dk_rxfer; + sdisk.dk_wxfer = diskp->dk_wxfer; sdisk.dk_seek = diskp->dk_seek; - sdisk.dk_bytes = diskp->dk_bytes; + sdisk.dk_bytes = diskp->dk_rbytes + diskp->dk_wbytes; + sdisk.dk_rbytes = diskp->dk_rbytes; + sdisk.dk_wbytes = diskp->dk_wbytes; sdisk.dk_attachtime_sec = diskp->dk_attachtime.tv_sec; sdisk.dk_attachtime_usec = diskp->dk_attachtime.tv_usec; sdisk.dk_timestamp_sec = diskp->dk_timestamp.tv_sec; @@ -431,7 +442,6 @@ sysctl_diskstats(int *name, u_int namelen, void *vwhere, size_t *sizep) return (error); } - struct bufq_fcfs { TAILQ_HEAD(, buf) bq_head; /* actual list of buffers */ }; diff --git a/sys/sys/disk.h b/sys/sys/disk.h index af43a84d2cbd..21ce2721a3cf 100644 --- a/sys/sys/disk.h +++ b/sys/sys/disk.h @@ -1,4 +1,4 @@ -/* $NetBSD: disk.h,v 1.19 2002/09/18 01:46:25 chs Exp $ */ +/* $NetBSD: disk.h,v 1.20 2002/11/01 11:32:02 mrg Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -112,9 +112,11 @@ struct disk { * on certain types of disks. */ int dk_busy; /* busy counter */ - u_int64_t dk_xfer; /* total number of transfers */ + u_int64_t dk_rxfer; /* total number of read transfers */ + u_int64_t dk_wxfer; /* total number of write transfers */ u_int64_t dk_seek; /* total independent seek operations */ - u_int64_t dk_bytes; /* total bytes transfered */ + u_int64_t dk_rbytes; /* total bytes read */ + u_int64_t dk_wbytes; /* total bytes written */ struct timeval dk_attachtime; /* time disk was attached */ struct timeval dk_timestamp; /* timestamp of last unbusy */ struct timeval dk_time; /* total time spent busy */ @@ -147,6 +149,11 @@ struct disk_sysctl { u_int32_t dk_timestamp_usec; u_int32_t dk_time_sec; u_int32_t dk_time_usec; + /* New separate read/write stats */ + u_int64_t dk_rxfer; + u_int64_t dk_rbytes; + u_int64_t dk_wxfer; + u_int64_t dk_wbytes; }; struct dkdriver { @@ -182,7 +189,7 @@ void disk_init __P((void)); void disk_attach __P((struct disk *)); void disk_detach __P((struct disk *)); void disk_busy __P((struct disk *)); -void disk_unbusy __P((struct disk *, long)); +void disk_unbusy __P((struct disk *, long, int)); void disk_resetstat __P((struct disk *)); struct disk *disk_find __P((char *)); #endif