int count_lock_queue __P((void));
LIST_HEAD(bufhashhdr, buf) *bufhashtbl, invalhash;u_long	bufhash;/* * Insq/Remq for the buffer hash lists. */#define	binshash(bp, dp)	LIST_INSERT_HEAD(dp, bp, b_hash)#define	bremhash(bp)		LIST_REMOVE(bp, b_hash)/* * Definitions for the buffer free lists. */#define	BQUEUES		4		/* number of free buffer queues */#define	BQ_LOCKED	0		/* super-blocks &c */#define	BQ_LRU		1		/* lru, useful buffers */#define	BQ_AGE		2		/* rubbish */#define	BQ_EMPTY	3		/* buffer headers with no memory */TAILQ_HEAD(bqueues, buf) bufqueues[BQUEUES];int needbuffer;int syncer_needbuffer;struct bio_ops bioops;/* * Insq/Remq for the buffer free lists. */#define	binsheadfree(bp, dp)	TAILQ_INSERT_HEAD(dp, bp, b_freelist)#define	binstailfree(bp, dp)	TAILQ_INSERT_TAIL(dp, bp, b_freelist)static __inline struct buf *bio_doread __P((struct vnode *, daddr_t, int,					    struct ucred *, int));int count_lock_queue __P((void));int getnewbuf __P((int slpflag, int slptimeo, struct buf **));/* * We keep a few counters to monitor the utilization of the buffer cache * *  numdirtybufs - number of dirty (B_DELWRI) buffers. unused. *  lodirtybufs  - ? unused. *  hidirtybufs  - ? unused. *  numfreebufs  - number of buffers on BQ_LRU and BQ_AGE. unused. *  numcleanbufs - number of clean (!B_DELWRI) buffers on BQ_LRU and BQ_AGE. *    Used to track the need to speedup the syncer and for the syncer reserve. *  numemptybufs - number of buffers on BQ_EMPTY. unused. *  mincleanbufs - the lowest number of clean buffers this far. */int numdirtybufs;	/* number of all dirty buffers */int lodirtybufs, hidirtybufs;int numfreebufs;	/* number of buffers on LRU+AGE free lists */int numcleanbufs;	/* number of clean buffers on LRU+AGE free lists */int numemptybufs;	/* number of buffers on EMPTY list */int locleanbufs;#ifdef DEBUGint mincleanbufs;#endifvoidbremfree(bp)	struct buf *bp;{	struct bqueues *dp = NULL;	/*	 * We only calculate the head of the freelist when removing	 * the last element of the list as that is the only time that	 * it is needed (e.g. to reset the tail pointer).	 *	 * NB: This makes an assumption about how tailq's are implemented.	 */	if (bp->b_freelist.tqe_next == NULL) {		for (dp = bufqueues; dp < &bufqueues[BQUEUES]; dp++)			if (dp->tqh_last == &bp->b_freelist.tqe_next)				break;		if (dp == &bufqueues[BQUEUES])			panic("bremfree: lost tail");	}	if (bp->b_bufsize <= 0) {		numemptybufs--;	} else if (!ISSET(bp->b_flags, B_LOCKED)) {		numfreebufs--;		if (!ISSET(bp->b_flags, B_DELWRI)) {			numcleanbufs--;#ifdef DEBUG			if (mincleanbufs > numcleanbufs)				mincleanbufs = numcleanbufs;#endif		}	}	TAILQ_REMOVE(dp, bp, b_freelist);}