projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix B_WRITE->B_READ; DCLR & NSECT in hp; dont search if static 1 drive
[unix-history]
/
usr
/
src
/
sys
/
kern
/
kern_physio.c
diff --git
a/usr/src/sys/kern/kern_physio.c
b/usr/src/sys/kern/kern_physio.c
index
afda887
..
022c45c
100644
(file)
--- a/
usr/src/sys/kern/kern_physio.c
+++ b/
usr/src/sys/kern/kern_physio.c
@@
-1,4
+1,4
@@
-/* kern_physio.c
3.10
%G% */
+/* kern_physio.c
4.4
%G% */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
@@
-10,6
+10,7
@@
#include "../h/seg.h"
#include "../h/pte.h"
#include "../h/vm.h"
#include "../h/seg.h"
#include "../h/pte.h"
#include "../h/vm.h"
+#include "../h/trace.h"
/*
* The following several routines allocate and free
/*
* The following several routines allocate and free
@@
-99,6
+100,9
@@
daddr_t blkno;
bp = getblk(dev, blkno);
if (bp->b_flags&B_DONE) {
bp = getblk(dev, blkno);
if (bp->b_flags&B_DONE) {
+#ifdef EPAWNJ
+ trace(TR_BREAD|TR_HIT, dev, blkno);
+#endif
#ifdef DISKMON
io_info.ncache++;
#endif
#ifdef DISKMON
io_info.ncache++;
#endif
@@
-107,6
+111,9
@@
daddr_t blkno;
bp->b_flags |= B_READ;
bp->b_bcount = BSIZE;
(*bdevsw[major(dev)].d_strategy)(bp);
bp->b_flags |= B_READ;
bp->b_bcount = BSIZE;
(*bdevsw[major(dev)].d_strategy)(bp);
+#ifdef EPAWNJ
+ trace(TR_BREAD|TR_MISS, dev, blkno);
+#endif
#ifdef DISKMON
io_info.nread++;
#endif
#ifdef DISKMON
io_info.nread++;
#endif
@@
-133,20
+140,33
@@
daddr_t blkno, rablkno;
bp->b_flags |= B_READ;
bp->b_bcount = BSIZE;
(*bdevsw[major(dev)].d_strategy)(bp);
bp->b_flags |= B_READ;
bp->b_bcount = BSIZE;
(*bdevsw[major(dev)].d_strategy)(bp);
+#ifdef EPAWNJ
+ trace(TR_BREAD|TR_MISS, dev, blkno);
+#endif
#ifdef DISKMON
io_info.nread++;
#endif
u.u_vm.vm_inblk++; /* pay for read */
}
#ifdef DISKMON
io_info.nread++;
#endif
u.u_vm.vm_inblk++; /* pay for read */
}
+#ifdef EPAWNJ
+ else
+ trace(TR_BREAD|TR_HIT, dev, blkno);
+#endif
}
if (rablkno && !incore(dev, rablkno)) {
rabp = getblk(dev, rablkno);
}
if (rablkno && !incore(dev, rablkno)) {
rabp = getblk(dev, rablkno);
- if (rabp->b_flags & B_DONE)
+ if (rabp->b_flags & B_DONE)
{
brelse(rabp);
brelse(rabp);
- else {
+#ifdef EPAWNJ
+ trace(TR_BREAD|TR_HIT|TR_RA, dev, blkno);
+#endif
+ } else {
rabp->b_flags |= B_READ|B_ASYNC;
rabp->b_bcount = BSIZE;
(*bdevsw[major(dev)].d_strategy)(rabp);
rabp->b_flags |= B_READ|B_ASYNC;
rabp->b_bcount = BSIZE;
(*bdevsw[major(dev)].d_strategy)(rabp);
+#ifdef EPAWNJ
+ trace(TR_BREAD|TR_MISS|TR_RA, dev, rablock);
+#endif
#ifdef DISKMON
io_info.nreada++;
#endif
#ifdef DISKMON
io_info.nreada++;
#endif
@@
-176,6
+196,9
@@
register struct buf *bp;
#endif
if ((flag&B_DELWRI) == 0)
u.u_vm.vm_oublk++; /* noone paid yet */
#endif
if ((flag&B_DELWRI) == 0)
u.u_vm.vm_oublk++; /* noone paid yet */
+#ifdef EPAWNJ
+ trace(TR_BWRITE, bp->b_dev, dbtofsb(bp->b_blkno));
+#endif
(*bdevsw[major(bp->b_dev)].d_strategy)(bp);
if ((flag&B_ASYNC) == 0) {
iowait(bp);
(*bdevsw[major(bp->b_dev)].d_strategy)(bp);
if ((flag&B_ASYNC) == 0) {
iowait(bp);
@@
-298,9
+321,11
@@
dev_t dev;
daddr_t blkno;
{
register struct buf *bp, *dp, *ep;
daddr_t blkno;
{
register struct buf *bp, *dp, *ep;
- register int i, x;
- register int dblkno = fsbtodb(blkno);
+ register int i, x, dblkno;
+ if ((unsigned)blkno >= 1 << (sizeof(int)*NBBY-PGSHIFT))
+ blkno = 1 << ((sizeof(int)*NBBY-PGSHIFT) + 1);
+ dblkno = fsbtodb(blkno);
loop:
(void) spl0();
for (bp = &buf[bufhash[BUFHASH(blkno)]]; bp != &buf[-1];
loop:
(void) spl0();
for (bp = &buf[bufhash[BUFHASH(blkno)]]; bp != &buf[-1];
@@
-339,7
+364,7
@@
daddr_t blkno;
sleep((caddr_t)&bfreelist, PRIBIO+1);
goto loop;
}
sleep((caddr_t)&bfreelist, PRIBIO+1);
goto loop;
}
- spl0();
+
(void)
spl0();
bp = bfreelist.av_forw;
notavail(bp);
if (bp->b_flags & B_DELWRI) {
bp = bfreelist.av_forw;
notavail(bp);
if (bp->b_flags & B_DELWRI) {
@@
-350,6
+375,10
@@
daddr_t blkno;
if (bp->b_dev == NODEV)
goto done;
/* INLINE EXPANSION OF bunhash(bp) */
if (bp->b_dev == NODEV)
goto done;
/* INLINE EXPANSION OF bunhash(bp) */
+#ifdef EPAWNJ
+ trace(TR_BRELSE, bp->b_dev, dbtofsb(bp->b_blkno));
+#endif
+ (void) spl6();
i = BUFHASH(dbtofsb(bp->b_blkno));
x = bp - buf;
if (bufhash[i] == x) {
i = BUFHASH(dbtofsb(bp->b_blkno));
x = bp - buf;
if (bufhash[i] == x) {
@@
-364,6
+393,7
@@
daddr_t blkno;
panic("getblk");
}
done:
panic("getblk");
}
done:
+ (void) spl0();
/* END INLINE EXPANSION */
bp->b_flags = B_BUSY;
bp->b_back->b_forw = bp->b_forw;
/* END INLINE EXPANSION */
bp->b_flags = B_BUSY;
bp->b_back->b_forw = bp->b_forw;
@@
-404,8
+434,12
@@
loop:
bwrite(bp);
goto loop;
}
bwrite(bp);
goto loop;
}
- if (bp->b_dev != NODEV)
+ if (bp->b_dev != NODEV) {
+#ifdef EPAWNJ
+ trace(TR_BRELSE, bp->b_dev, dbtofsb(bp->b_blkno));
+#endif
bunhash(bp);
bunhash(bp);
+ }
bp->b_flags = B_BUSY;
bp->b_back->b_forw = bp->b_forw;
bp->b_forw->b_back = bp->b_back;
bp->b_flags = B_BUSY;
bp->b_back->b_forw = bp->b_forw;
bp->b_forw->b_back = bp->b_back;
@@
-422,23
+456,26
@@
bunhash(bp)
register struct buf *bp;
{
register struct buf *ep;
register struct buf *bp;
{
register struct buf *ep;
- register int i, x;
+ register int i, x
, s
;
if (bp->b_dev == NODEV)
return;
if (bp->b_dev == NODEV)
return;
+ s = spl6();
i = BUFHASH(dbtofsb(bp->b_blkno));
x = bp - buf;
if (bufhash[i] == x) {
bufhash[i] = bp->b_hlink;
i = BUFHASH(dbtofsb(bp->b_blkno));
x = bp - buf;
if (bufhash[i] == x) {
bufhash[i] = bp->b_hlink;
-
return
;
+
goto ret
;
}
for (ep = &buf[bufhash[i]]; ep != &buf[-1];
ep = &buf[ep->b_hlink])
if (ep->b_hlink == x) {
ep->b_hlink = bp->b_hlink;
}
for (ep = &buf[bufhash[i]]; ep != &buf[-1];
ep = &buf[ep->b_hlink])
if (ep->b_hlink == x) {
ep->b_hlink = bp->b_hlink;
-
return
;
+
goto ret
;
}
panic("bunhash");
}
panic("bunhash");
+ret:
+ splx(s);
}
/*
}
/*
@@
-587,12
+624,14
@@
swap(p, dblkno, addr, nbytes, rdflg, flag, dev, pfcent)
bp->b_bcount = c;
bp->b_blkno = dblkno;
bp->b_dev = dev;
bp->b_bcount = c;
bp->b_blkno = dblkno;
bp->b_dev = dev;
+ if (flag & B_DIRTY) {
+ swpf[bp - swbuf] = pfcent;
+ swsize[bp - swbuf] = nbytes;
+ }
(*bdevsw[major(dev)].d_strategy)(bp);
if (flag & B_DIRTY) {
if (c < nbytes)
panic("big push");
(*bdevsw[major(dev)].d_strategy)(bp);
if (flag & B_DIRTY) {
if (c < nbytes)
panic("big push");
- swsize[bp - swbuf] = nbytes;
- swpf[bp - swbuf] = pfcent;
return;
}
(void) spl6();
return;
}
(void) spl6();