diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-06-11 12:35:48 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-06-11 12:35:48 +0000 |
commit | b2b0c7fef4a45b9670abe28fb02d4d6501aba3cf (patch) | |
tree | b68620a361e298733e9f56b948838c732f923917 | |
parent | 737d3ccddb6f7c737402ff2b6608eef74cba85eb (diff) |
back out biomem diff since it is not right yet. Doing very large
file copies to nfsv2 causes the system to eventually peg the console.
On the console ^T indicates that the load is increasing rapidly, ddb
indicates many calls to getbuf, there is some very slow nfs traffic
making none (or extremely slow) progress. Eventually some machines
seize up entirely.
48 files changed, 403 insertions, 367 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c index 4c88f82fff7..3d3ebf48e5f 100644 --- a/sys/arch/alpha/alpha/disksubr.c +++ b/sys/arch/alpha/alpha/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.90 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.91 2008/06/11 12:35:38 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -67,7 +67,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { msg = "disk label read error"; @@ -121,7 +121,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; @@ -135,7 +135,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) csum += *p++; *p = csum; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c index bdb21c167b1..17320717cd2 100644 --- a/sys/arch/amd64/amd64/disksubr.c +++ b/sys/arch/amd64/amd64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.54 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.55 2008/06/11 12:35:40 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -141,14 +141,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/amd64/amd64/dkcsum.c b/sys/arch/amd64/amd64/dkcsum.c index 97a03de1dee..9edd48c4745 100644 --- a/sys/arch/amd64/amd64/dkcsum.c +++ b/sys/arch/amd64/amd64/dkcsum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dkcsum.c,v 1.12 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: dkcsum.c,v 1.13 2008/06/11 12:35:40 deraadt Exp $ */ /*- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. @@ -106,7 +106,7 @@ dkcsumattach(void) /* Read blocks to cksum. XXX maybe a d_read should be used. */ bp->b_blkno = 0; bp->b_bcount = bios_cksumlen * DEV_BSIZE; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; bp->b_cylinder = 0; (*bdsw->d_strategy)(bp); if ((error = biowait(bp))) { diff --git a/sys/arch/arm/arm/disksubr.c b/sys/arch/arm/arm/disksubr.c index 8cc30d5db05..ae50df5e58b 100644 --- a/sys/arch/arm/arm/disksubr.c +++ b/sys/arch/arm/arm/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.49 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.50 2008/06/11 12:35:40 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -114,14 +114,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/aviion/aviion/disksubr.c b/sys/arch/aviion/aviion/disksubr.c index bc76d44841a..dbe54a4f5fb 100644 --- a/sys/arch/aviion/aviion/disksubr.c +++ b/sys/arch/aviion/aviion/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.41 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.42 2008/06/11 12:35:40 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -121,7 +121,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/hp300/dev/ct.c b/sys/arch/hp300/dev/ct.c index ce23c6eeba7..9d333952869 100644 --- a/sys/arch/hp300/dev/ct.c +++ b/sys/arch/hp300/dev/ct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ct.c,v 1.19 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: ct.c,v 1.20 2008/06/11 12:35:40 deraadt Exp $ */ /* $NetBSD: ct.c,v 1.21 1997/04/02 22:37:23 scottr Exp $ */ /* @@ -431,7 +431,7 @@ ctcommand(dev, cmd, cnt) } while (cnt-- > 0) { - bp->b_flags = B_BUSY | B_RAW; + bp->b_flags = B_BUSY; if (cmd == MTBSF) { sc->sc_blkno = sc->sc_eofs[sc->sc_eofp]; sc->sc_eofp--; diff --git a/sys/arch/hp300/dev/mt.c b/sys/arch/hp300/dev/mt.c index 13385b29ece..4e7de80a3a8 100644 --- a/sys/arch/hp300/dev/mt.c +++ b/sys/arch/hp300/dev/mt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mt.c,v 1.19 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: mt.c,v 1.20 2008/06/11 12:35:41 deraadt Exp $ */ /* $NetBSD: mt.c,v 1.8 1997/03/31 07:37:29 scottr Exp $ */ /* @@ -407,7 +407,7 @@ mtcommand(dev, cmd, cnt) bp->b_cmd = cmd; bp->b_dev = dev; do { - bp->b_flags = B_BUSY | B_CMD | B_RAW; + bp->b_flags = B_BUSY | B_CMD; mtstrategy(bp); biowait(bp); if (bp->b_flags & B_ERROR) { diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c index 0f440c2a2a0..1c5a1480879 100644 --- a/sys/arch/hp300/hp300/disksubr.c +++ b/sys/arch/hp300/hp300/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.42 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.43 2008/06/11 12:35:41 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */ /* @@ -68,7 +68,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { msg = "disk label I/O error"; @@ -115,7 +115,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) bp->b_dev = dev; bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; @@ -123,7 +123,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Write it in the regular place. */ dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c index 430e505a7a9..cac0bc04b5f 100644 --- a/sys/arch/hppa/hppa/disksubr.c +++ b/sys/arch/hppa/hppa/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.70 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.71 2008/06/11 12:35:41 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -107,7 +107,7 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), /* read LIF volume header */ bp->b_blkno = btodb(LIF_VOLSTART); bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) return "LIF volume header I/O error"; @@ -122,7 +122,7 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), /* read LIF directory */ dbp->b_blkno = lifstodb(lvp->vol_addr); dbp->b_bcount = lp->d_secsize; - dbp->b_flags = B_BUSY | B_READ | B_RAW; + dbp->b_flags = B_BUSY | B_READ; (*strat)(dbp); if (biowait(dbp)) { @@ -154,7 +154,7 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), /* read LIF directory */ dbp->b_blkno = lifstodb(p->dir_addr); dbp->b_bcount = lp->d_secsize; - dbp->b_flags = B_BUSY | B_READ | B_RAW; + dbp->b_flags = B_BUSY | B_READ; (*strat)(dbp); if (biowait(dbp)) { @@ -218,7 +218,7 @@ finished: bp->b_blkno = fsoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); /* if successful, locate disk label within block and validate */ @@ -258,14 +258,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c index 5670bd4cf11..8b72b8b47e2 100644 --- a/sys/arch/hppa64/hppa64/disksubr.c +++ b/sys/arch/hppa64/hppa64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.54 2008/06/10 20:50:22 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.55 2008/06/11 12:35:41 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -107,7 +107,7 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), /* read LIF volume header */ bp->b_blkno = btodb(LIF_VOLSTART); bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) return "LIF volume header I/O error"; @@ -122,7 +122,7 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), /* read LIF directory */ dbp->b_blkno = lifstodb(lvp->vol_addr); dbp->b_bcount = lp->d_secsize; - dbp->b_flags = B_BUSY | B_READ | B_RAW; + dbp->b_flags = B_BUSY | B_READ; (*strat)(dbp); if (biowait(dbp)) { @@ -154,7 +154,7 @@ readliflabel(struct buf *bp, void (*strat)(struct buf *), /* read LIF directory */ dbp->b_blkno = lifstodb(p->dir_addr); dbp->b_bcount = lp->d_secsize; - dbp->b_flags = B_BUSY | B_READ | B_RAW; + dbp->b_flags = B_BUSY | B_READ; (*strat)(dbp); if (biowait(dbp)) { @@ -218,7 +218,7 @@ finished: bp->b_blkno = fsoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); /* if successful, locate disk label within block and validate */ @@ -258,14 +258,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 085fbe7386a..056b495327b 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.95 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.96 2008/06/11 12:35:41 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -141,14 +141,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/i386/i386/dkcsum.c b/sys/arch/i386/i386/dkcsum.c index f0b553864e5..0305da7e7eb 100644 --- a/sys/arch/i386/i386/dkcsum.c +++ b/sys/arch/i386/i386/dkcsum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dkcsum.c,v 1.23 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: dkcsum.c,v 1.24 2008/06/11 12:35:41 deraadt Exp $ */ /*- * Copyright (c) 1997 Niklas Hallqvist. All rights reserved. @@ -106,7 +106,7 @@ dkcsumattach(void) /* Read blocks to cksum. XXX maybe a d_read should be used. */ bp->b_blkno = 0; bp->b_bcount = bios_cksumlen * DEV_BSIZE; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; bp->b_cylinder = 0; (*bdsw->d_strategy)(bp); if ((error = biowait(bp))) { diff --git a/sys/arch/landisk/landisk/disksubr.c b/sys/arch/landisk/landisk/disksubr.c index ff32a6f63b1..4e5a626b540 100644 --- a/sys/arch/landisk/landisk/disksubr.c +++ b/sys/arch/landisk/landisk/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.37 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.38 2008/06/11 12:35:42 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -114,14 +114,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/luna88k/luna88k/disksubr.c b/sys/arch/luna88k/luna88k/disksubr.c index fcc4ac7c628..8f513a3263c 100644 --- a/sys/arch/luna88k/luna88k/disksubr.c +++ b/sys/arch/luna88k/luna88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.34 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.35 2008/06/11 12:35:42 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.12 2002/02/19 17:09:44 wiz Exp $ */ /* @@ -124,7 +124,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { msg = "disk label read error"; @@ -179,7 +179,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) bp->b_blkno = LABELSECTOR; bp->b_cylinder = 0; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); error = biowait(bp); @@ -191,7 +191,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) if (error) goto done; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/mac68k/mac68k/disksubr.c b/sys/arch/mac68k/mac68k/disksubr.c index 68f06f95f90..60913ad8c13 100644 --- a/sys/arch/mac68k/mac68k/disksubr.c +++ b/sys/arch/mac68k/mac68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.53 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.54 2008/06/11 12:35:42 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.22 1997/11/26 04:18:20 briggs Exp $ */ /* @@ -349,7 +349,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = size; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { msg = "disk label I/O error"; @@ -366,7 +366,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), /* Get a MI label */ bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { msg = "disk label I/O error"; @@ -423,7 +423,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; @@ -437,7 +437,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c index c3312650d39..3d0cddf00da 100644 --- a/sys/arch/macppc/macppc/disksubr.c +++ b/sys/arch/macppc/macppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.58 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.59 2008/06/11 12:35:42 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -111,7 +111,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), /* First check for a DPME (HFS) disklabel */ bp->b_blkno = 1; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) return ("DPME partition I/O error"); @@ -129,7 +129,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = 1+i; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) return ("DPME partition I/O error"); @@ -165,7 +165,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), /* next, dig out disk label */ bp->b_blkno = hfspartoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) return("disk label I/O error"); @@ -194,14 +194,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c index 8c1746e6b7f..bf4dc36761f 100644 --- a/sys/arch/mvme68k/mvme68k/disksubr.c +++ b/sys/arch/mvme68k/mvme68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.61 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.62 2008/06/11 12:35:42 deraadt Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -67,7 +67,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); error = biowait(bp); if (error) { @@ -122,14 +122,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; bsdtocpulabel(lp, (struct mvmedisklabel *)bp->b_data); - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c index adda564aaf1..0d8477b0a13 100644 --- a/sys/arch/mvme88k/mvme88k/disksubr.c +++ b/sys/arch/mvme88k/mvme88k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.57 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.58 2008/06/11 12:35:43 deraadt Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -67,7 +67,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); error = biowait(bp); if (error) { @@ -123,14 +123,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; bsdtocpulabel(lp, (struct mvmedisklabel *)bp->b_data); - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/mvmeppc/mvmeppc/disksubr.c b/sys/arch/mvmeppc/mvmeppc/disksubr.c index 4fa866a3473..16cf8c0a2ce 100644 --- a/sys/arch/mvmeppc/mvmeppc/disksubr.c +++ b/sys/arch/mvmeppc/mvmeppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.55 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.56 2008/06/11 12:35:43 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -114,14 +114,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/sgi/sgi/disksubr.c b/sys/arch/sgi/sgi/disksubr.c index 6a68ec41127..ef7ef682b6f 100644 --- a/sys/arch/sgi/sgi/disksubr.c +++ b/sys/arch/sgi/sgi/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.4 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.5 2008/06/11 12:35:43 deraadt Exp $ */ /* * Copyright (c) 1999 Michael Shalayeff @@ -59,7 +59,7 @@ readbsdlabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = sec; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); /* if successful, locate disk label within block and validate */ @@ -145,7 +145,7 @@ readsgilabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = 0; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); /* if successful, locate disk label within block and validate */ @@ -215,7 +215,7 @@ finished: bp->b_blkno = fsoffs + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { msg = "disk label I/O error"; @@ -249,14 +249,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/socppc/socppc/disksubr.c b/sys/arch/socppc/socppc/disksubr.c index 555a943cbe5..eee93504473 100644 --- a/sys/arch/socppc/socppc/disksubr.c +++ b/sys/arch/socppc/socppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.2 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.3 2008/06/11 12:35:43 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -111,7 +111,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), /* First check for a DPME (HFS) disklabel */ bp->b_blkno = 1; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) return ("DPME partition I/O error"); @@ -129,7 +129,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), bp->b_blkno = 1+i; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) return ("DPME partition I/O error"); @@ -165,7 +165,7 @@ readdpmelabel(struct buf *bp, void (*strat)(struct buf *), /* next, dig out disk label */ bp->b_blkno = hfspartoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) return("disk label I/O error"); @@ -194,14 +194,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = partoff + LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c index e5936b9ecb0..ae18fc2933b 100644 --- a/sys/arch/sparc/dev/fd.c +++ b/sys/arch/sparc/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.59 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: fd.c,v 1.60 2008/06/11 12:35:43 deraadt Exp $ */ /* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */ /*- @@ -1911,7 +1911,7 @@ fdformat(dev, finfo, p) if (bp == 0) return (ENOBUFS); - bp->b_flags = B_BUSY | B_PHYS | B_FORMAT | B_RAW; + bp->b_flags = B_BUSY | B_PHYS | B_FORMAT; bp->b_proc = p; bp->b_dev = dev; diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c index ff125165eb4..e5f6d531917 100644 --- a/sys/arch/sparc/sparc/disksubr.c +++ b/sys/arch/sparc/sparc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.73 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.74 2008/06/11 12:35:43 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -105,7 +105,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { msg = "disk label read error"; @@ -169,7 +169,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Write out the updated label. */ bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c index 03fcc61b4ef..8011833f26e 100644 --- a/sys/arch/sparc64/dev/fd.c +++ b/sys/arch/sparc64/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.22 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: fd.c,v 1.23 2008/06/11 12:35:44 deraadt Exp $ */ /* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */ /*- @@ -1965,7 +1965,7 @@ fdformat(dev, finfo, p) if (bp == NULL) return (ENOBUFS); - bp->b_flags = B_BUSY | B_PHYS | B_FORMAT | B_RAW; + bp->b_flags = B_BUSY | B_PHYS | B_FORMAT; bp->b_proc = p; bp->b_dev = dev; diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c index 5023c1394af..8e45c71930c 100644 --- a/sys/arch/sparc64/sparc64/disksubr.c +++ b/sys/arch/sparc64/sparc64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.49 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.50 2008/06/11 12:35:44 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */ /* @@ -98,7 +98,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { msg = "disk label read error"; @@ -162,7 +162,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Write out the updated label. */ bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/arch/vax/uba/ts.c b/sys/arch/vax/uba/ts.c index e52e1d1a6f8..8b6160e9281 100644 --- a/sys/arch/vax/uba/ts.c +++ b/sys/arch/vax/uba/ts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ts.c,v 1.18 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: ts.c,v 1.19 2008/06/11 12:35:44 deraadt Exp $ */ /* $NetBSD: ts.c,v 1.11 1997/01/11 11:34:43 ragge Exp $ */ /*- @@ -379,7 +379,7 @@ tscommand (dev, cmd, count) tsleep ((caddr_t)bp, PRIBIO, "tscommand", 0); /* check MOT-flag !!! */ } - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; splx(s); diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index 00192a55999..8b9c7f63693 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.55 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: disksubr.c,v 1.56 2008/06/11 12:35:44 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */ /* @@ -76,7 +76,7 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { msg = "I/O error"; @@ -125,14 +125,14 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) /* Read it in, slap the new label in, and write it back out */ bp->b_blkno = LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if ((error = biowait(bp)) != 0) goto done; dlp = (struct disklabel *)(bp->b_data + LABELOFFSET); *dlp = *lp; - bp->b_flags = B_BUSY | B_WRITE | B_RAW; + bp->b_flags = B_BUSY | B_WRITE; (*strat)(bp); error = biowait(bp); diff --git a/sys/conf/files b/sys/conf/files index ce464781f75..5e3a667a38f 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $OpenBSD: files,v 1.433 2008/06/10 20:14:36 beck Exp $ +# $OpenBSD: files,v 1.434 2008/06/11 12:35:44 deraadt Exp $ # $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 @@ -707,7 +707,6 @@ file kern/uipc_socket2.c file kern/uipc_syscalls.c file kern/uipc_usrreq.c file kern/vfs_bio.c -file kern/vfs_biomem.c file kern/vfs_cache.c file kern/vfs_cluster.c file kern/vfs_conf.c diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c index f964b3fe02f..1c103718d3f 100644 --- a/sys/dev/isa/fd.c +++ b/sys/dev/isa/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.72 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: fd.c,v 1.73 2008/06/11 12:35:45 deraadt Exp $ */ /* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */ /*- @@ -1125,7 +1125,7 @@ fdformat(dev, finfo, p) if (bp == NULL) return ENOBUFS; - bp->b_flags = B_BUSY | B_PHYS | B_FORMAT | B_RAW; + bp->b_flags = B_BUSY | B_PHYS | B_FORMAT; bp->b_proc = p; bp->b_dev = dev; diff --git a/sys/isofs/udf/udf_subr.c b/sys/isofs/udf/udf_subr.c index 8ce51fa34f9..87ef5367e74 100644 --- a/sys/isofs/udf/udf_subr.c +++ b/sys/isofs/udf/udf_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udf_subr.c,v 1.15 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: udf_subr.c,v 1.16 2008/06/11 12:35:46 deraadt Exp $ */ /* * Copyright (c) 2006, Miodrag Vallat @@ -110,7 +110,7 @@ udf_disklabelspoof(dev_t dev, void (*strat)(struct buf *), */ bp->b_blkno = sector * btodb(bsize); bp->b_bcount = bsize; - bp->b_flags |= (B_READ | B_RAW); + bp->b_flags = B_BUSY | B_READ; bp->b_resid = bp->b_blkno / lp->d_secpercyl; (*strat)(bp); @@ -130,7 +130,7 @@ udf_disklabelspoof(dev_t dev, void (*strat)(struct buf *), for (sector = mvds_start; sector < mvds_end; sector++) { bp->b_blkno = sector * btodb(bsize); bp->b_bcount = bsize; - bp->b_flags |= (B_READ | B_RAW); + bp->b_flags = B_BUSY | B_READ; bp->b_resid = bp->b_blkno / lp->d_secpercyl; (*strat)(bp); diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index 0759e01f2b8..1aa25f464a9 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sched.c,v 1.4 2008/06/10 20:14:36 beck Exp $ */ +/* $OpenBSD: kern_sched.c,v 1.5 2008/06/11 12:35:46 deraadt Exp $ */ /* * Copyright (c) 2007 Artur Grabowski <art@openbsd.org> * @@ -113,8 +113,6 @@ sched_idle(void *v) } } - splassert(IPL_NONE); - cpu_idle_enter(); while (sched_is_idle()) cpu_idle_cycle(); diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c index 3af4f6c1a10..15c2bd86377 100644 --- a/sys/kern/spec_vnops.c +++ b/sys/kern/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.50 2008/06/10 20:14:36 beck Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.51 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -447,7 +447,7 @@ loop: if ((bp->b_flags & B_DELWRI) == 0) panic("spec_fsync: not dirty"); bremfree(bp); - buf_acquire(bp); + bp->b_flags |= B_BUSY; splx(s); bawrite(bp); goto loop; diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index cfa60f25b41..d4db8e2e299 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_disk.c,v 1.76 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: subr_disk.c,v 1.77 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: subr_disk.c,v 1.17 1996/03/16 23:17:08 christos Exp $ */ /* @@ -399,7 +399,7 @@ readdoslabel(struct buf *bp, void (*strat)(struct buf *), /* read boot record */ bp->b_blkno = part_blkno; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) { /*wrong*/ if (partoffp) @@ -542,7 +542,7 @@ notfat: bp->b_blkno = dospartoff + DOS_LABELSECTOR; bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ | B_RAW; + bp->b_flags = B_BUSY | B_READ; (*strat)(bp); if (biowait(bp)) return ("disk label I/O error"); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index f44253ef163..11c450fc982 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.104 2008/06/10 20:14:36 beck Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.105 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -78,12 +78,14 @@ u_long bufhash; /* * Definitions for the buffer free lists. */ -#define BQUEUES 2 /* number of free buffer queues */ +#define BQUEUES 6 /* number of free buffer queues */ #define BQ_DIRTY 0 /* LRU queue with dirty buffers */ -#define BQ_CLEAN 1 /* LRU queue with clean buffers */ + TAILQ_HEAD(bqueues, buf) bufqueues[BQUEUES]; +int bqpages[BQUEUES]; /* pages allocated, per queue */ +int bqpagelow; int needbuffer; struct bio_ops bioops; @@ -91,6 +93,7 @@ struct bio_ops bioops; * Buffer pool for I/O buffers. */ struct pool bufpool; +struct vm_map *buf_map; struct bufhead bufhead = LIST_HEAD_INITIALIZER(bufhead); struct buf *buf_get(size_t); struct buf *buf_stub(struct vnode *, daddr64_t); @@ -104,7 +107,7 @@ void buf_put(struct buf *); struct buf *bio_doread(struct vnode *, daddr64_t, int, int); struct buf *getnewbuf(size_t, int, int, int *); -void buf_init(struct buf *); +void buf_init(struct buf *, int); void bread_cluster_callback(struct buf *); /* @@ -114,33 +117,54 @@ void bread_cluster_callback(struct buf *); * numdirtypages - number of pages on BQ_DIRTY queue. * lodirtypages - low water mark for buffer cleaning daemon. * hidirtypages - high water mark for buffer cleaning daemon. + * numfreepages - number of pages on BQ_CLEAN and BQ_DIRTY queues. unused. * numcleanpages - number of pages on BQ_CLEAN queue. * Used to track the need to speedup the cleaner and * as a reserve for special processes like syncer. * maxcleanpages - the highest page count on BQ_CLEAN. */ - -struct bcachestats bcstats; +long numbufpages; +long numdirtypages; long lodirtypages; long hidirtypages; +long numfreepages; +long numcleanpages; long locleanpages; long hicleanpages; long maxcleanpages; -/* XXX - should be defined here. */ -extern int bufcachepercent; - -vsize_t bufkvm; - struct proc *cleanerproc; int bd_req; /* Sleep point for cleaner daemon. */ +int size2cqueue(int *size); + +int +size2cqueue(int *size) +{ + int i = 0, q; + int s = *size; + s -= 1; + while (s > 0) { + s = s >> 1; + i++; + } + if (i < PAGE_SHIFT) { + i = PAGE_SHIFT; /* < 4096 -> 4096 */ + } + *size = 1 << i; + q = (i + 1 - PAGE_SHIFT); /* XXX 4096 is queue 1 */ + if (q >= BQUEUES) + panic("queue %d > BQUEUES %d", q, BQUEUES); + if (q == 0) + panic("can't return dirty q"); + return(q); +} + void bremfree(struct buf *bp) { struct bqueues *dp = NULL; - - splassert(IPL_BIO); + int queue; /* * We only calculate the head of the freelist when removing @@ -156,26 +180,38 @@ bremfree(struct buf *bp) if (dp == &bufqueues[BQUEUES]) panic("bremfree: lost tail"); } + numfreepages -= atop(bp->b_bufsize); if (!ISSET(bp->b_flags, B_DELWRI)) { - bcstats.numcleanpages -= atop(bp->b_bufsize); - } else { - bcstats.numdirtypages -= atop(bp->b_bufsize); - } + int qs = bp->b_bufsize; + queue = size2cqueue(&qs); + numcleanpages -= atop(bp->b_bufsize); + bqpages[queue] -= atop(bp->b_bufsize); + } else + numdirtypages -= atop(bp->b_bufsize); TAILQ_REMOVE(dp, bp, b_freelist); - bcstats.freebufs--; } void -buf_init(struct buf *bp) +buf_init(struct buf *bp, int size) { + int npages, queue; + splassert(IPL_BIO); + npages = atop(size); bzero((char *)bp, sizeof *bp); bp->b_vnbufs.le_next = NOLIST; bp->b_freelist.tqe_next = NOLIST; bp->b_synctime = time_uptime + 300; bp->b_dev = NODEV; + queue = size2cqueue(&size); LIST_INIT(&bp->b_dep); + numbufpages += npages; + numfreepages += npages; + numcleanpages += npages; + bqpages[queue] += npages; + if (maxcleanpages < numcleanpages) + maxcleanpages = numcleanpages; } /* @@ -202,7 +238,7 @@ buf_stub(struct vnode *vp, daddr64_t lblkno) bp->b_dev = NODEV; bp->b_bufsize = 0; bp->b_data = NULL; - bp->b_flags = 0; + bp->b_flags = B_BUSY; bp->b_dev = NODEV; bp->b_blkno = bp->b_lblkno = lblkno; bp->b_iodone = NULL; @@ -214,11 +250,8 @@ buf_stub(struct vnode *vp, daddr64_t lblkno) LIST_INIT(&bp->b_dep); - buf_acquire_unmapped(bp); - s = splbio(); LIST_INSERT_HEAD(&bufhead, bp, b_list); - bcstats.numbufs++; bgetvp(vp, bp); splx(s); @@ -228,31 +261,39 @@ buf_stub(struct vnode *vp, daddr64_t lblkno) struct buf * buf_get(size_t size) { + struct bqueues *dp; struct buf *bp; int npages; + int queue, qs; + void *data; splassert(IPL_BIO); KASSERT(size > 0); size = round_page(size); - npages = atop(size); + qs = size; + queue = size2cqueue(&qs); + npages = atop(qs); - if (bcstats.numbufpages + npages > bufpages) + if (numbufpages + npages > bufpages) return (NULL); bp = pool_get(&bufpool, PR_WAITOK); - buf_init(bp); + data = (void *)uvm_km_alloc(buf_map, qs); + if (data == NULL) { + pool_put(&bufpool, bp); + return (NULL); + } + buf_init(bp, qs); bp->b_flags = B_INVAL; - buf_alloc_pages(bp, size); - bp->b_data = NULL; - binsheadfree(bp, &bufqueues[BQ_CLEAN]); + bp->b_bufsize = qs; + bp->b_data = data; + dp = &bufqueues[queue]; + binsheadfree(bp, dp); binshash(bp, &invalhash); LIST_INSERT_HEAD(&bufhead, bp, b_list); - bcstats.numbufs++; - bcstats.freebufs++; - bcstats.numcleanpages += atop(bp->b_bufsize); return (bp); } @@ -262,7 +303,7 @@ buf_put(struct buf *bp) { splassert(IPL_BIO); #ifdef DIAGNOSTIC - if (bp->b_pobj != NULL) + if (bp->b_data != NULL) KASSERT(bp->b_bufsize > 0); #endif #ifdef DIAGNOSTIC @@ -279,10 +320,13 @@ buf_put(struct buf *bp) panic("buf_put: b_dep is not empty"); #endif LIST_REMOVE(bp, b_list); - bcstats.numbufs--; - if (buf_dealloc_mem(bp) != 0) - return; + if (bp->b_data != NULL) { + bremhash(bp); + numbufpages -= atop(bp->b_bufsize); + uvm_km_free(buf_map, (vaddr_t)bp->b_data, bp->b_bufsize); + } + pool_put(&bufpool, bp); } @@ -292,56 +336,39 @@ buf_put(struct buf *bp) void bufinit(void) { + vaddr_t minaddr, maxaddr; struct bqueues *dp; - /* XXX - for now */ - bufpages = bufcachepercent = bufkvm = 0; - - /* - * If MD code doesn't say otherwise, use 10% of kvm for mappings and - * 10% physmem for pages. - */ - if (bufcachepercent == 0) - bufcachepercent = 10; - if (bufpages == 0) - bufpages = physmem * bufcachepercent / 100; - - if (bufkvm == 0) - bufkvm = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 10; - - /* - * Don't use more than twice the amount of bufpages for mappings. - * It's twice since we map things sparsely. - */ - if (bufkvm > bufpages * PAGE_SIZE) - bufkvm = bufpages * PAGE_SIZE; - /* - * Round bufkvm to MAXPHYS because we allocate chunks of va space - * in MAXPHYS chunks. - */ - bufkvm &= ~(MAXPHYS - 1); - pool_init(&bufpool, sizeof(struct buf), 0, 0, 0, "bufpl", NULL); pool_setipl(&bufpool, IPL_BIO); for (dp = bufqueues; dp < &bufqueues[BQUEUES]; dp++) TAILQ_INIT(dp); + minaddr = vm_map_min(kernel_map); + buf_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, + ptoa(bufpages), 0, FALSE, NULL); - /* - * hmm - bufkvm is an argument because it's static, while - * bufpages is global because it can change while running. - */ - buf_mem_init(bufkvm); + /* + * XXX don't starve any one queue below 5% of the total number + * of buffer cache pages. + */ + bqpagelow = bufpages / 20; bufhashtbl = hashinit(bufpages / 4, M_CACHE, M_WAITOK, &bufhash); hidirtypages = (bufpages / 4) * 3; lodirtypages = bufpages / 2; /* - * When we hit 95% of pages being clean, we bring them down to - * 90% to have some slack. + * Reserve 5% of bufpages for syncer's needs, + * but not more than 25% and if possible + * not less than 2 * MAXBSIZE. locleanpages + * value must be not too small */ - hicleanpages = bufpages - (bufpages / 20); - locleanpages = bufpages - (bufpages / 10); + hicleanpages = bufpages / 2; + locleanpages = hicleanpages / 2; + if (locleanpages < atop(2 * MAXBSIZE)) + locleanpages = atop(2 * MAXBSIZE); + if (locleanpages > bufpages / 4) + locleanpages = bufpages / 4; maxcleanpages = locleanpages; } @@ -361,9 +388,8 @@ bio_doread(struct vnode *vp, daddr64_t blkno, int size, int async) */ if (!ISSET(bp->b_flags, (B_DONE | B_DELWRI))) { SET(bp->b_flags, B_READ | async); - bcstats.pendingreads++; - bcstats.numreads++; VOP_STRATEGY(bp); + /* Pay for the read. */ curproc->p_stats->p_ru.ru_inblock++; /* XXX */ } else if (async) { @@ -451,7 +477,7 @@ bread_cluster_callback(struct buf *bp) } free(xbpp, M_TEMP); - bp->b_pobj = NULL; + bp->b_data = NULL; buf_put(bp); } @@ -459,8 +485,9 @@ int bread_cluster(struct vnode *vp, daddr64_t blkno, int size, struct buf **rbpp) { struct buf *bp, **xbpp; - int howmany, maxra, i, inc; + int howmany, i, maxra, inc; daddr64_t sblkno; + size_t spill; *rbpp = bio_doread(vp, blkno, size, 0); @@ -517,16 +544,11 @@ bread_cluster(struct vnode *vp, daddr64_t blkno, int size, struct buf **rbpp) inc = btodb(size); for (i = 0; i < howmany; i++) { - bcstats.pendingreads++; - bcstats.numreads++; SET(xbpp[i]->b_flags, B_READ | B_ASYNC); binshash(xbpp[i], BUFHASH(vp, xbpp[i]->b_lblkno)); xbpp[i]->b_blkno = sblkno + (i * inc); xbpp[i]->b_bufsize = xbpp[i]->b_bcount = size; - xbpp[i]->b_data = NULL; - xbpp[i]->b_pobj = bp->b_pobj; - xbpp[i]->b_poffs = bp->b_poffs + (i * size); - buf_acquire_unmapped(xbpp[i]); + xbpp[i]->b_data = bp->b_data + (i * size); } bp->b_blkno = sblkno; @@ -535,8 +557,12 @@ bread_cluster(struct vnode *vp, daddr64_t blkno, int size, struct buf **rbpp) bp->b_saveaddr = (void *)xbpp; bp->b_iodone = bread_cluster_callback; bp->b_vp = vp; - bcstats.pendingreads++; - bcstats.numreads++; + spill = bp->b_bufsize - bp->b_bcount; + if (spill) { + uvm_km_free(buf_map, (vaddr_t) bp->b_data + bp->b_bcount, + spill); + numbufpages -= atop(spill); + } VOP_STRATEGY(bp); curproc->p_stats->p_ru.ru_inblock++; @@ -583,8 +609,6 @@ bwrite(struct buf *bp) else mp->mnt_stat.f_syncwrites++; } - bcstats.pendingwrites++; - bcstats.numwrites++; wasdelayed = ISSET(bp->b_flags, B_DELWRI); CLR(bp->b_flags, (B_READ | B_DONE | B_ERROR | B_DELWRI)); @@ -699,11 +723,6 @@ buf_dirty(struct buf *bp) { splassert(IPL_BIO); -#ifdef DIAGNOSTIC - if (!ISSET(bp->b_flags, B_BUSY)) - panic("Trying to dirty buffer on freelist!"); -#endif - if (ISSET(bp->b_flags, B_DELWRI) == 0) { SET(bp->b_flags, B_DELWRI); bp->b_synctime = time_uptime + 35; @@ -719,10 +738,6 @@ buf_undirty(struct buf *bp) { splassert(IPL_BIO); -#ifdef DIAGNOSTIC - if (!ISSET(bp->b_flags, B_BUSY)) - panic("Trying to undirty buffer on freelist!"); -#endif if (ISSET(bp->b_flags, B_DELWRI)) { CLR(bp->b_flags, B_DELWRI); reassignbuf(bp); @@ -754,6 +769,8 @@ brelse(struct buf *bp) SET(bp->b_flags, B_INVAL); if (ISSET(bp->b_flags, B_INVAL)) { + int queue, qs; + /* * If the buffer is invalid, place it in the clean queue, so it * can be reused. @@ -772,29 +789,37 @@ brelse(struct buf *bp) * If the buffer has no associated data, place it back in the * pool. */ - if (bp->b_data == NULL && bp->b_pobj == NULL) { + if (bp->b_data == NULL) { buf_put(bp); splx(s); return; } - bcstats.numcleanpages += atop(bp->b_bufsize); - if (maxcleanpages < bcstats.numcleanpages) - maxcleanpages = bcstats.numcleanpages; - binsheadfree(bp, &bufqueues[BQ_CLEAN]); + qs = bp->b_bufsize; + queue = size2cqueue(&qs); + numcleanpages += atop(bp->b_bufsize); + bqpages[queue] += atop(bp->b_bufsize); + if (maxcleanpages < numcleanpages) + maxcleanpages = numcleanpages; + binsheadfree(bp, &bufqueues[queue]); } else { /* * It has valid data. Put it on the end of the appropriate * queue, so that it'll stick around for as long as possible. */ + int queue, qs; + numfreepages += atop(bp->b_bufsize); + qs = bp->b_bufsize; + queue = size2cqueue(&qs); if (!ISSET(bp->b_flags, B_DELWRI)) { - bcstats.numcleanpages += atop(bp->b_bufsize); - if (maxcleanpages < bcstats.numcleanpages) - maxcleanpages = bcstats.numcleanpages; - bufq = &bufqueues[BQ_CLEAN]; + numcleanpages += atop(bp->b_bufsize); + bqpages[queue] += atop(bp->b_bufsize); + if (maxcleanpages < numcleanpages) + maxcleanpages = numcleanpages; + bufq = &bufqueues[queue]; } else { - bcstats.numdirtypages += atop(bp->b_bufsize); + numdirtypages += atop(bp->b_bufsize); bufq = &bufqueues[BQ_DIRTY]; } if (ISSET(bp->b_flags, B_AGE)) { @@ -807,9 +832,7 @@ brelse(struct buf *bp) } /* Unlock the buffer. */ - bcstats.freebufs++; - CLR(bp->b_flags, (B_AGE | B_ASYNC | B_NOCACHE | B_DEFERRED)); - buf_release(bp); + CLR(bp->b_flags, (B_AGE | B_ASYNC | B_BUSY | B_NOCACHE | B_DEFERRED)); /* Wake up any processes waiting for any buffer to become free. */ if (needbuffer) { @@ -894,10 +917,8 @@ start: } if (!ISSET(bp->b_flags, B_INVAL)) { - bcstats.cachehits++; + SET(bp->b_flags, (B_BUSY | B_CACHE)); bremfree(bp); - SET(bp->b_flags, B_CACHE); - buf_acquire(bp); splx(s); break; } @@ -925,10 +946,6 @@ start: bgetvp(vp, bp); splx(s); } -#ifdef DIAGNOSTIC - if (!ISSET(bp->b_flags, B_BUSY)) - panic("getblk buffer not B_BUSY"); -#endif return (bp); } @@ -955,7 +972,7 @@ struct buf * getnewbuf(size_t size, int slpflag, int slptimeo, int *ep) { struct buf *bp; - int s; + int s, error, queue, qs; #if 0 /* we would really like this but sblock update kills it */ KASSERT(curproc != syncerproc && curproc != cleanerproc); @@ -965,47 +982,72 @@ getnewbuf(size_t size, int slpflag, int slptimeo, int *ep) /* * Wake up cleaner if we're getting low on pages. */ - if (bcstats.numdirtypages >= hidirtypages || bcstats.numcleanpages <= locleanpages) + if (numdirtypages >= hidirtypages || numcleanpages <= locleanpages) wakeup(&bd_req); - /* - * If we're above the high water mark for clean pages, - * free down to the low water mark. - */ - if (bcstats.numcleanpages > hicleanpages) { - while (bcstats.numcleanpages > locleanpages) { - bp = TAILQ_FIRST(&bufqueues[BQ_CLEAN]); - bremfree(bp); - if (bp->b_vp) - brelvp(bp); - bremhash(bp); - buf_put(bp); - } - } - /* we just ask. it can say no.. */ getsome: - bp = buf_get(size); + qs = size; + queue = size2cqueue(&qs); + bp = buf_get(qs); /* XXX use qs instead and no need in buf_get? */ if (bp == NULL) { - int freemax = 5; - int i = freemax; - while ((bp = TAILQ_FIRST(&bufqueues[BQ_CLEAN])) && i--) { - bremfree(bp); - if (bp->b_vp) - brelvp(bp); - bremhash(bp); - buf_put(bp); + /* + * No free ones, try to reuse a clean one of the same or + * larger size. + */ + do { + bp = TAILQ_FIRST(&bufqueues[queue]); + queue++; + } while (bp == NULL && queue < BQUEUES); + } + if (bp == NULL) { + /* we couldn't reuse a free one, nothing of the right size */ + /* XXX free 20 buffers per q - ugly hack should really + * reuse big ones without truncating. fix later + */ + int q, gotsome = 0; + int freemax = 20; + for (q = 1; q < BQUEUES; q++) { + int i = freemax; + while (bqpages[q] > bqpagelow + && (bp = TAILQ_FIRST(&bufqueues[q])) + && i--) { + gotsome++; + bremfree(bp); + if (LIST_FIRST(&bp->b_dep) != NULL) + buf_deallocate(bp); + + if (ISSET(bp->b_flags, B_DELWRI)) { + CLR(bp->b_flags, B_DELWRI); + } + + if (bp->b_vp) + brelvp(bp); + + buf_put(bp); + } } - if (freemax != i) + if (gotsome) goto getsome; - splx(s); - return (NULL); + } + if (bp == NULL) { + /* wait for a free buffer of any kind */ + needbuffer++; + error = tsleep(&needbuffer, slpflag | (PRIBIO + 1), + "getnewbuf", slptimeo); + if (ep != NULL) { + *ep = error; + if (error) { + splx(s); + return (NULL); + } + } + goto getsome; } bremfree(bp); /* Buffer is no longer on free lists. */ - bp->b_flags = 0; - buf_acquire(bp); + SET(bp->b_flags, B_BUSY); #ifdef DIAGNOSTIC if (ISSET(bp->b_flags, B_DELWRI)) @@ -1025,6 +1067,7 @@ getsome: #endif /* clear out various other fields */ + bp->b_flags = B_BUSY; bp->b_dev = NODEV; bp->b_blkno = bp->b_lblkno = 0; bp->b_iodone = NULL; @@ -1052,7 +1095,8 @@ buf_daemon(struct proc *p) s = splbio(); for (;;) { - if (bcstats.numdirtypages < hidirtypages) + if (!numdirtypages || + (numdirtypages < hidirtypages && !needbuffer)) tsleep(&bd_req, PRIBIO - 7, "cleaner", 0); getmicrouptime(&starttime); @@ -1060,11 +1104,11 @@ buf_daemon(struct proc *p) while ((bp = TAILQ_FIRST(&bufqueues[BQ_DIRTY]))) { struct timeval tv; - if (bcstats.numdirtypages < lodirtypages) + if (numdirtypages < lodirtypages && !needbuffer) break; bremfree(bp); - buf_acquire(bp); + SET(bp->b_flags, B_BUSY); splx(s); if (ISSET(bp->b_flags, B_INVAL)) { @@ -1081,10 +1125,10 @@ buf_daemon(struct proc *p) buf_countdeps(bp, 0, 0)) { SET(bp->b_flags, B_DEFERRED); s = splbio(); - bcstats.numdirtypages += atop(bp->b_bufsize); + numfreepages += atop(bp->b_bufsize); + numdirtypages += atop(bp->b_bufsize); binstailfree(bp, &bufqueues[BQ_DIRTY]); - bcstats.freebufs++; - buf_release(bp); + CLR(bp->b_flags, B_BUSY); continue; } @@ -1110,8 +1154,6 @@ biowait(struct buf *bp) { int s; - KASSERT(!(bp->b_flags & B_ASYNC)); - s = splbio(); while (!ISSET(bp->b_flags, B_DONE)) tsleep(bp, PRIBIO + 1, "biowait", 0); @@ -1161,11 +1203,8 @@ biodone(struct buf *bp) if (!ISSET(bp->b_flags, B_READ)) { CLR(bp->b_flags, B_WRITEINPROG); - bcstats.pendingwrites--; vwakeup(bp->b_vp); - } else if (bcstats.numbufs && - (!(ISSET(bp->b_flags, B_RAW) || ISSET(bp->b_flags, B_PHYS)))) - bcstats.pendingreads--; + } if (ISSET(bp->b_flags, B_CALL)) { /* if necessary, call out */ CLR(bp->b_flags, B_CALL); /* but note callout done */ @@ -1179,3 +1218,66 @@ biodone(struct buf *bp) } } } + +#if 1 +void +vfs_bufstats(void) { + return; +} +/* #ifdef DDB */ +#else +/* + * Print out statistics on the current allocation of the buffer pool. + * Can be enabled to print out on every ``sync'' by setting "syncprt" + * in vfs_syscalls.c using sysctl. + */ +void +vfs_bufstats(void) +{ + int s, i, j, count; + struct buf *bp; + struct bqueues *dp; + int counts[MAXBSIZE/PAGE_SIZE+1]; + int totals[BQUEUES]; + long ptotals[BQUEUES]; + long pages; + static char *bname[BQUEUES] = { "CLEAN", "DIRTY", "EMPTY" }; + + s = splbio(); + for (dp = bufqueues, i = 0; dp < &bufqueues[BQUEUES]; dp++, i++) { + count = 0; + pages = 0; + for (j = 0; j <= MAXBSIZE/PAGE_SIZE; j++) + counts[j] = 0; + TAILQ_FOREACH(bp, dp, b_freelist) { + counts[bp->b_bufsize/PAGE_SIZE]++; + count++; + pages += atop(bp->b_bufsize); + } + totals[i] = count; + ptotals[i] = pages; + printf("%s: total-%d(%d pages)", bname[i], count, pages); + for (j = 0; j <= MAXBSIZE/PAGE_SIZE; j++) + if (counts[j] != 0) + printf(", %d-%d", j * PAGE_SIZE, counts[j]); + printf("\n"); + } + if ((ptotals[BQ_CLEAN] + ptotals[BQ_DIRTY]) != numfreepages) + printf("numfreepages counter wrong: %ld != %ld\n", + numfreepages, ptotals[BQ_CLEAN] + ptotals[BQ_DIRTY]); + if (ptotals[BQ_CLEAN] != numcleanpages) + printf("numcleanpages counter wrong: %ld != %ld\n", + numcleanpages, ptotals[<BQ_CLEAN]); + else + printf("numcleanpages: %ld\n", numcleanpages); + if (numdirtypages != ptotals[BQ_DIRTY]) + printf("numdirtypages counter wrong: %ld != %ld\n", + numdirtypages, ptotals[BQ_DIRTY]); + else + printf("numdirtypages: %ld\n", numdirtypages); + + printf("syncer eating up to %ld pages from %ld reserved\n", + maxcleanpages - hicleanpages, locleanpages); + splx(s); +} +#endif /* DEBUG */ diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 65153b0cdfc..b55c0242c8b 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.168 2008/06/10 20:14:36 beck Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.169 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -120,7 +120,7 @@ void vntblinit(void) { /* buffer cache may need a vnode for each buffer */ - maxvnodes = bufpages; + maxvnodes = desiredvnodes; pool_init(&vnode_pool, sizeof(struct vnode), 0, 0, 0, "vnodes", &pool_allocator_nointr); TAILQ_INIT(&vnode_hold_list); @@ -1256,12 +1256,8 @@ vfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, free(tmpvfsp, M_TEMP); return (ret); - case VFS_BCACHESTAT: /* buffer cache statistics */ - ret = sysctl_rdstruct(oldp, oldlenp, newp, &bcstats, - sizeof(struct bcachestats)); - return(ret); - } + return (EOPNOTSUPP); } @@ -1668,7 +1664,7 @@ vfs_syncwait(int verbose) if (bp->b_flags & B_DELWRI) { s = splbio(); bremfree(bp); - buf_acquire(bp); + bp->b_flags |= B_BUSY; splx(s); nbusy++; bawrite(bp); @@ -1839,7 +1835,7 @@ loop: break; } bremfree(bp); - buf_acquire(bp); + bp->b_flags |= B_BUSY; /* * XXX Since there are no node locks for NFS, I believe * there is a slight chance that a delayed write will @@ -1877,7 +1873,7 @@ loop: if ((bp->b_flags & B_DELWRI) == 0) panic("vflushbuf: not dirty"); bremfree(bp); - buf_acquire(bp); + bp->b_flags |= B_BUSY; splx(s); /* * Wait for I/O associated with indirect blocks to complete, diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index 3af4f6c1a10..15c2bd86377 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.50 2008/06/10 20:14:36 beck Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.51 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -447,7 +447,7 @@ loop: if ((bp->b_flags & B_DELWRI) == 0) panic("spec_fsync: not dirty"); bremfree(bp); - buf_acquire(bp); + bp->b_flags |= B_BUSY; splx(s); bawrite(bp); goto loop; diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index caedf7bdc5c..c1ba30237c8 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.62 2008/06/11 04:52:27 blambert Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.63 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -746,8 +746,7 @@ nfssvc_iod(p) (B_BUSY|B_DELWRI|B_NEEDCOMMIT|B_NOCACHE))!=B_DELWRI) continue; bremfree(nbp); - nbp->b_flags |= B_ASYNC; - buf_acquire(nbp); + nbp->b_flags |= (B_BUSY|B_ASYNC); break; } /* diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 189f16f1e2b..9fc77ab8095 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.87 2008/06/11 04:52:27 blambert Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.88 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -2736,8 +2736,7 @@ again: != (B_DELWRI | B_NEEDCOMMIT)) continue; bremfree(bp); - bp->b_flags |= B_WRITEINPROG; - buf_acquire(bp); + bp->b_flags |= (B_BUSY | B_WRITEINPROG); /* * A list of these buffers is kept so that the * second loop knows which buffers have actually @@ -2815,12 +2814,10 @@ loop: if ((passone || !commit) && (bp->b_flags & B_NEEDCOMMIT)) continue; bremfree(bp); - if (passone || !commit) { - bp->b_flags |= B_ASYNC; - } else { - bp->b_flags |= (B_ASYNC|B_WRITEINPROG|B_NEEDCOMMIT); - } - buf_acquire(bp); + if (passone || !commit) + bp->b_flags |= (B_BUSY|B_ASYNC); + else + bp->b_flags |= (B_BUSY|B_ASYNC|B_WRITEINPROG|B_NEEDCOMMIT); splx(s); VOP_BWRITE(bp); goto loop; @@ -3016,8 +3013,6 @@ nfs_writebp(bp, force) if (retv) { if (force) bp->b_flags |= B_WRITEINPROG; - bcstats.pendingwrites++; - bcstats.numwrites++; VOP_STRATEGY(bp); } diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 50edefe61f4..59b696bf135 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.h,v 1.58 2008/06/10 20:14:37 beck Exp $ */ +/* $OpenBSD: buf.h,v 1.59 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */ /* @@ -87,12 +87,6 @@ struct buf { dev_t b_dev; /* Device associated with buffer. */ caddr_t b_data; /* associated data */ void *b_saveaddr; /* Original b_data for physio. */ - - TAILQ_ENTRY(buf) b_valist; /* LRU of va to reuse. */ - - struct uvm_object *b_pobj; /* Object containing the pages */ - off_t b_poffs; /* Offset within object */ - daddr64_t b_lblkno; /* Logical block number. */ daddr64_t b_blkno; /* Underlying physical block number. */ /* Function to call upon completion. @@ -167,8 +161,6 @@ struct buf *bufq_default_get(struct bufq *); #define B_DEFERRED 0x04000000 /* Skipped over for cleaning */ #define B_SCANNED 0x08000000 /* Block already pushed during sync */ #define B_PDAEMON 0x10000000 /* I/O started by pagedaemon */ -#define B_RELEASED 0x20000000 /* free this buffer after its kvm */ -#define B_NOTMAPPED 0x40000000 /* BUSY, but not necessarily mapped */ #define B_BITS "\010\001AGE\002NEEDCOMMIT\003ASYNC\004BAD\005BUSY\006CACHE" \ "\007CALL\010DELWRI\012DONE\013EINTR\014ERROR" \ @@ -236,23 +228,6 @@ struct buf *getblk(struct vnode *, daddr64_t, int, int, int); struct buf *geteblk(int); struct buf *incore(struct vnode *, daddr64_t); -/* - * buf_kvm_init initializes the kvm handling for buffers. - * buf_acquire sets the B_BUSY flag and ensures that the buffer is - * mapped in the kvm. - * buf_release clears the B_BUSY flag and allows the buffer to become - * unmapped. - * buf_unmap is for internal use only. Unmaps the buffer from kvm. - */ -void buf_mem_init(vsize_t); -void buf_acquire(struct buf *); -void buf_acquire_unmapped(struct buf *); -void buf_release(struct buf *); -int buf_dealloc_mem(struct buf *); -void buf_alloc_pages(struct buf *, vsize_t); -void buf_free_pages(struct buf *); - - void minphys(struct buf *bp); int physio(void (*strategy)(struct buf *), struct buf *bp, dev_t dev, int flags, void (*minphys)(struct buf *), struct uio *uio); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 64e01badfef..0e12cb233e7 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mount.h,v 1.85 2008/06/10 20:14:37 beck Exp $ */ +/* $OpenBSD: mount.h,v 1.86 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */ /* @@ -465,13 +465,10 @@ struct mount { #define VFS_MAXTYPENUM 1 /* int: highest defined filesystem type */ #define VFS_CONF 2 /* struct: vfsconf for filesystem given as next argument */ -#define VFS_BCACHESTAT 3 /* struct: buffer cache statistics given - as next argument */ #define CTL_VFSGENCTL_NAMES { \ { 0, 0 }, \ { "maxtypenum", CTLTYPE_INT }, \ - { "conf", CTLTYPE_NODE }, \ - { "bcachestat", CTLTYPE_STRUCT } \ + { "conf", CTLTYPE_NODE } \ } /* @@ -488,24 +485,6 @@ struct vfsconf { struct vfsconf *vfc_next; /* next in list */ }; -/* buffer cache statistics */ -struct bcachestats { - long numbufs; /* number of buffers allocated */ - long freebufs; /* number of free buffers */ - long numbufpages; /* number of pages in buffer cache */ - long numfreepages; /* number of free pages */ - long numdirtypages; /* number of dirty free pages */ - long numcleanpages; /* number of clean free pages */ - long pendingwrites; /* number of pending writes */ - long pendingreads; /* number of pending reads */ - long numwrites; /* total writes started */ - long numreads; /* total reads started */ - long cachehits; /* total reads found in cache */ -}; -#ifdef _KERNEL -extern struct bcachestats bcstats; -#endif - /* * Operations supported on mounted file system. */ diff --git a/sys/ufs/ext2fs/ext2fs_bmap.c b/sys/ufs/ext2fs/ext2fs_bmap.c index 5de33f44a8f..1506fefffef 100644 --- a/sys/ufs/ext2fs/ext2fs_bmap.c +++ b/sys/ufs/ext2fs/ext2fs_bmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_bmap.c,v 1.16 2008/06/10 20:14:37 beck Exp $ */ +/* $OpenBSD: ext2fs_bmap.c,v 1.17 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: ext2fs_bmap.c,v 1.5 2000/03/30 12:41:11 augustss Exp $ */ /* @@ -190,7 +190,6 @@ ext2fs_bmaparray(struct vnode *vp, int32_t bn, daddr64_t *bnp, bp->b_flags |= B_READ; VOP_STRATEGY(bp); curproc->p_stats->p_ru.ru_inblock++; /* XXX */ - bcstats.pendingreads++; if ((error = biowait(bp)) != 0) { brelse(bp); return (error); diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c index a974b9f0874..f8cbb04f19d 100644 --- a/sys/ufs/ext2fs/ext2fs_inode.c +++ b/sys/ufs/ext2fs/ext2fs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_inode.c,v 1.40 2008/06/10 20:14:37 beck Exp $ */ +/* $OpenBSD: ext2fs_inode.c,v 1.41 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */ /* @@ -466,8 +466,6 @@ ext2fs_indirtrunc(struct inode *ip, int32_t lbn, int32_t dbn, int32_t lastbn, in bp = getblk(vp, lbn, (int)fs->e2fs_bsize, 0, 0); if (!(bp->b_flags & (B_DONE | B_DELWRI))) { curproc->p_stats->p_ru.ru_inblock++; /* pay for read */ - bcstats.pendingreads++; - bcstats.numreads++; bp->b_flags |= B_READ; if (bp->b_bcount > bp->b_bufsize) panic("ext2fs_indirtrunc: bad buffer size"); diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index 4021a9da0fc..99594c39f93 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_inode.c,v 1.53 2008/06/10 20:14:37 beck Exp $ */ +/* $OpenBSD: ffs_inode.c,v 1.54 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */ /* @@ -501,8 +501,6 @@ ffs_indirtrunc(struct inode *ip, daddr64_t lbn, daddr64_t dbn, bp = getblk(vp, lbn, (int)fs->fs_bsize, 0, 0); if (!(bp->b_flags & (B_DONE | B_DELWRI))) { curproc->p_stats->p_ru.ru_inblock++; /* pay for read */ - bcstats.pendingreads++; - bcstats.numreads++; bp->b_flags |= B_READ; if (bp->b_bcount > bp->b_bufsize) panic("ffs_indirtrunc: bad buffer size"); diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 8b74fef005e..e6fe34b1559 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_softdep.c,v 1.95 2008/06/10 20:14:37 beck Exp $ */ +/* $OpenBSD: ffs_softdep.c,v 1.96 2008/06/11 12:35:46 deraadt Exp $ */ /* * Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -4691,9 +4691,9 @@ softdep_fsync_mountdev(vp, waitfor) /* * If it is already scheduled, skip to the next buffer. */ - splassert(IPL_BIO); if (bp->b_flags & B_BUSY) continue; + bp->b_flags |= B_BUSY; if ((bp->b_flags & B_DELWRI) == 0) { FREE_LOCK(&lk); @@ -4705,10 +4705,10 @@ softdep_fsync_mountdev(vp, waitfor) */ if ((wk = LIST_FIRST(&bp->b_dep)) == NULL || wk->wk_type != D_BMSAFEMAP) { + bp->b_flags &= ~B_BUSY; continue; } bremfree(bp); - buf_acquire(bp); FREE_LOCK(&lk); (void) bawrite(bp); ACQUIRE_LOCK(&lk); @@ -5616,7 +5616,7 @@ getdirtybuf(bp, waitfor) if ((bp->b_flags & B_DELWRI) == 0) return (0); bremfree(bp); - buf_acquire(bp); + bp->b_flags |= B_BUSY; return (1); } diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 489a4880473..e03549518ab 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vnops.c,v 1.49 2008/06/10 20:14:37 beck Exp $ */ +/* $OpenBSD: ffs_vnops.c,v 1.50 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: ffs_vnops.c,v 1.7 1996/05/11 18:27:24 mycroft Exp $ */ /* @@ -449,8 +449,7 @@ loop: } bremfree(bp); - buf_acquire(bp); - bp->b_flags |= B_SCANNED; + bp->b_flags |= B_BUSY | B_SCANNED; splx(s); /* * On our final pass through, do all I/O synchronously diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c index 75205c56bc3..68c8ea8521e 100644 --- a/sys/ufs/ufs/ufs_bmap.c +++ b/sys/ufs/ufs/ufs_bmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_bmap.c,v 1.27 2008/06/10 20:14:37 beck Exp $ */ +/* $OpenBSD: ufs_bmap.c,v 1.28 2008/06/11 12:35:46 deraadt Exp $ */ /* $NetBSD: ufs_bmap.c,v 1.3 1996/02/09 22:36:00 christos Exp $ */ /* @@ -173,8 +173,6 @@ ufs_bmaparray(struct vnode *vp, daddr64_t bn, daddr64_t *bnp, struct indir *ap, else { bp->b_blkno = blkptrtodb(ump, daddr); bp->b_flags |= B_READ; - bcstats.pendingreads++; - bcstats.numreads++; VOP_STRATEGY(bp); curproc->p_stats->p_ru.ru_inblock++; /* XXX */ if ((error = biowait(bp)) != 0) { diff --git a/sys/ufs/ufs/ufs_dirhash.c b/sys/ufs/ufs/ufs_dirhash.c index 5391c977caa..9184a466372 100644 --- a/sys/ufs/ufs/ufs_dirhash.c +++ b/sys/ufs/ufs/ufs_dirhash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_dirhash.c,v 1.18 2008/06/10 20:14:37 beck Exp $ */ +/* $OpenBSD: ufs_dirhash.c,v 1.19 2008/06/11 12:35:47 deraadt Exp $ */ /* * Copyright (c) 2001, 2002 Ian Dowse. All rights reserved. * @@ -211,6 +211,7 @@ ufsdirhash_build(struct inode *ip) if (UFS_BUFATOFF(ip, (off_t)pos, NULL, &bp) != 0) goto fail; } + /* Add this entry to the hash. */ ep = (struct direct *)((char *)bp->b_data + (pos & bmask)); if (ep->d_reclen == 0 || ep->d_reclen > diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c index 0aa5b021f12..b1590559352 100644 --- a/sys/uvm/uvm_swap.c +++ b/sys/uvm/uvm_swap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap.c,v 1.80 2008/06/10 20:50:23 beck Exp $ */ +/* $OpenBSD: uvm_swap.c,v 1.81 2008/06/11 12:35:47 deraadt Exp $ */ /* $NetBSD: uvm_swap.c,v 1.40 2000/11/17 11:39:39 mrg Exp $ */ /* @@ -1980,7 +1980,7 @@ uvm_swap_io(pps, startslot, npages, flags) * fill in the bp. we currently route our i/o through * /dev/drum's vnode [swapdev_vp]. */ - bp->b_flags = B_BUSY | B_NOCACHE | B_RAW | (flags & (B_READ|B_ASYNC)); + bp->b_flags = B_BUSY | B_NOCACHE | (flags & (B_READ|B_ASYNC)); bp->b_proc = &proc0; /* XXX */ bp->b_vnbufs.le_next = NOLIST; bp->b_data = (caddr_t)kva; |