- register struct vnode *vp;
- register struct buf *flist;
- int s;
-
-loop:
- s = splbio();
- for (flist = bfreelist; flist < &bfreelist[BQ_EMPTY]; flist++) {
- for (bp = flist->av_forw; bp != flist; bp = bp->av_forw) {
- if ((bp->b_flags & B_BUSY))
- continue;
- if ((bp->b_flags & B_DELWRI) == 0)
- continue;
- if ((vp = bp->b_vp) == NULL)
- continue;
- if (vp->v_mount == mountp ||
- (vp->v_type == VBLK && vp->v_mounton == mountp)) {
- splx(s);
- notavail(bp);
- (void) bawrite(bp);
- goto loop;
- }
- }
- }
- splx(s);
-}
-
-/*
- * Invalidate in core blocks belonging to closed or umounted filesystem
- *
- * We walk through the buffer pool and invalidate any buffers for the
- * indicated mount point. Normally this routine is preceeded by a bflush
- * call, so that on a quiescent filesystem there will be no dirty
- * buffers when we are done. We return the count of dirty buffers when
- * we are finished.
- */
-binval(mountp)
- struct mount *mountp;
-{
- register struct buf *bp;
- register struct bufhd *hp;
- register struct vnode *vp;
- int s, dirty = 0;
-#define dp ((struct buf *)hp)
-
-loop:
- for (hp = bufhash; hp < &bufhash[BUFHSZ]; hp++) {
- for (bp = dp->b_forw; bp != dp; bp = bp->b_forw) {
- if ((vp = bp->b_vp) == NULL)
- continue;
- if (vp->v_mount != mountp &&
- (vp->v_type != VBLK || vp->v_mounton != mountp))
- continue;
- s = splbio();
- if (bp->b_flags & B_BUSY) {
- bp->b_flags |= B_WANTED;
- sleep((caddr_t)bp, PRIBIO+1);
- splx(s);
- goto loop;
- }
- splx(s);
- notavail(bp);
- if (bp->b_flags & B_DELWRI) {
- (void) bawrite(bp);
- dirty++;
- continue;
- }
- bp->b_flags |= B_INVAL;
- brelvp(bp);
- brelse(bp);
+ register struct bqueues *dp;
+ int counts[MAXBSIZE/CLBYTES+1];
+ static char *bname[BQUEUES] = { "LOCKED", "LRU", "AGE", "EMPTY" };
+
+ for (dp = bufqueues, i = 0; dp < &bufqueues[BQUEUES]; dp++, i++) {
+ count = 0;
+ for (j = 0; j <= MAXBSIZE/CLBYTES; j++)
+ counts[j] = 0;
+ s = splbio();
+ for (bp = dp->tqh_first; bp; bp = bp->b_freelist.tqe_next) {
+ counts[bp->b_bufsize/CLBYTES]++;
+ count++;