xref: /onnv-gate/usr/src/uts/common/sys/buf.h (revision 5251:aad4f9e16063)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*5251Smrj  * Common Development and Distribution License (the "License").
6*5251Smrj  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*5251Smrj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
270Sstevel@tonic-gate /*	  All Rights Reserved  	*/
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
310Sstevel@tonic-gate  * The Regents of the University of California
320Sstevel@tonic-gate  * All Rights Reserved
330Sstevel@tonic-gate  *
340Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
350Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
360Sstevel@tonic-gate  * contributors.
370Sstevel@tonic-gate  */
380Sstevel@tonic-gate 
390Sstevel@tonic-gate #ifndef _SYS_BUF_H
400Sstevel@tonic-gate #define	_SYS_BUF_H
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
430Sstevel@tonic-gate 
440Sstevel@tonic-gate #include <sys/types32.h>
450Sstevel@tonic-gate #include <sys/t_lock.h>
460Sstevel@tonic-gate #include <sys/kstat.h>
470Sstevel@tonic-gate 
480Sstevel@tonic-gate #ifdef	__cplusplus
490Sstevel@tonic-gate extern "C" {
500Sstevel@tonic-gate #endif
510Sstevel@tonic-gate 
520Sstevel@tonic-gate /*
530Sstevel@tonic-gate  *	Each buffer in the pool is usually doubly linked into 2 lists:
540Sstevel@tonic-gate  *	the device with which it is currently associated (always)
550Sstevel@tonic-gate  *	and also on a list of blocks available for allocation
560Sstevel@tonic-gate  *	for other use (usually).
570Sstevel@tonic-gate  *	The latter list is kept in last-used order, and the two
580Sstevel@tonic-gate  *	lists are doubly linked to make it easy to remove
590Sstevel@tonic-gate  *	a buffer from one list when it was found by
600Sstevel@tonic-gate  *	looking through the other.
610Sstevel@tonic-gate  *	A buffer is on the available list, and is liable
620Sstevel@tonic-gate  *	to be reassigned to another disk block, if and only
630Sstevel@tonic-gate  *	if it is not marked BUSY.  When a buffer is busy, the
640Sstevel@tonic-gate  *	available-list pointers can be used for other purposes.
650Sstevel@tonic-gate  *	Most drivers use the forward ptr as a link in their I/O active queue.
660Sstevel@tonic-gate  *	A buffer header contains all the information required to perform I/O.
670Sstevel@tonic-gate  *	Most of the routines which manipulate these things are in bio.c.
680Sstevel@tonic-gate  *
690Sstevel@tonic-gate  *	There are a number of locks associated with the buffer management
700Sstevel@tonic-gate  *	system.
710Sstevel@tonic-gate  *	hbuf.b_lock:	protects hash chains, buffer hdr freelists
720Sstevel@tonic-gate  *			and delayed write freelist
730Sstevel@tonic-gate  *	bfree_lock;	protects the bfreelist structure
740Sstevel@tonic-gate  *	bhdr_lock:	protects the free header list
750Sstevel@tonic-gate  *	blist_lock:	protects b_list fields
760Sstevel@tonic-gate  *	buf.b_sem:	protects all remaining members in the buf struct
770Sstevel@tonic-gate  *	buf.b_io:	I/O synchronization variable
780Sstevel@tonic-gate  *
790Sstevel@tonic-gate  *	A buffer header is never "locked" (b_sem) when it is on
800Sstevel@tonic-gate  *	a "freelist" (bhdrlist or bfreelist avail lists).
810Sstevel@tonic-gate  */
820Sstevel@tonic-gate typedef struct	buf {
830Sstevel@tonic-gate 	int	b_flags;		/* see defines below */
840Sstevel@tonic-gate 	struct buf *b_forw;		/* headed by d_tab of conf.c */
850Sstevel@tonic-gate 	struct buf *b_back;		/*  "  */
860Sstevel@tonic-gate 	struct buf *av_forw;		/* position on free list, */
870Sstevel@tonic-gate 	struct buf *av_back;		/* if not BUSY */
880Sstevel@tonic-gate 	o_dev_t	b_dev;			/* OLD major+minor device name */
890Sstevel@tonic-gate 	size_t b_bcount;		/* transfer count */
900Sstevel@tonic-gate 	union {
910Sstevel@tonic-gate 		caddr_t b_addr;		/* low order core address */
920Sstevel@tonic-gate 		struct fs *b_fs;	/* superblocks */
930Sstevel@tonic-gate 		struct cg *b_cg;	/* UFS cylinder group block */
940Sstevel@tonic-gate 		struct dinode *b_dino;	/* UFS ilist */
950Sstevel@tonic-gate 		daddr32_t *b_daddr;	/* disk blocks */
960Sstevel@tonic-gate 	} b_un;
970Sstevel@tonic-gate 
980Sstevel@tonic-gate 	lldaddr_t	_b_blkno;	/* block # on device (union) */
990Sstevel@tonic-gate #define	b_lblkno	_b_blkno._f
1000Sstevel@tonic-gate #ifdef _LP64
1010Sstevel@tonic-gate #define	b_blkno		_b_blkno._f
1020Sstevel@tonic-gate #else
1030Sstevel@tonic-gate #define	b_blkno		_b_blkno._p._l
1040Sstevel@tonic-gate #endif /* _LP64 */
1050Sstevel@tonic-gate 
1060Sstevel@tonic-gate 	char	b_obs1;			/* obsolete */
1070Sstevel@tonic-gate 	size_t	b_resid;		/* words not transferred after error */
1080Sstevel@tonic-gate 	clock_t	b_start;		/* request start time */
1090Sstevel@tonic-gate 	struct  proc  *b_proc;		/* process doing physical or swap I/O */
1100Sstevel@tonic-gate 	struct	page  *b_pages;		/* page list for PAGEIO */
1110Sstevel@tonic-gate 	clock_t b_obs2;			/* obsolete */
1120Sstevel@tonic-gate 	/* Begin new stuff */
1130Sstevel@tonic-gate #define	b_actf	av_forw
1140Sstevel@tonic-gate #define	b_actl	av_back
1150Sstevel@tonic-gate #define	b_active b_bcount
1160Sstevel@tonic-gate #define	b_errcnt b_resid
1170Sstevel@tonic-gate 	size_t	b_bufsize;		/* size of allocated buffer */
1180Sstevel@tonic-gate 	int	(*b_iodone)(struct buf *);	/* function called by iodone */
1190Sstevel@tonic-gate 	struct	vnode *b_vp;		/* vnode associated with block */
1200Sstevel@tonic-gate 	struct 	buf *b_chain;		/* chain together all buffers here */
1210Sstevel@tonic-gate 	int	b_obs3;			/* obsolete */
1220Sstevel@tonic-gate 	int	b_error;		/* expanded error field */
1230Sstevel@tonic-gate 	void	*b_private;		/* "opaque" driver private area */
1240Sstevel@tonic-gate 	dev_t	b_edev;			/* expanded dev field */
1250Sstevel@tonic-gate 	ksema_t	b_sem;			/* Exclusive access to buf */
1260Sstevel@tonic-gate 	ksema_t	b_io;			/* I/O Synchronization */
1270Sstevel@tonic-gate 	struct buf *b_list;		/* List of potential B_DELWRI bufs */
1280Sstevel@tonic-gate 	struct page **b_shadow;		/* shadow page list */
1290Sstevel@tonic-gate 	void	*b_dip;			/* device info pointer */
1300Sstevel@tonic-gate 	struct vnode *b_file;		/* file associated with this buffer */
1310Sstevel@tonic-gate 	offset_t b_offset;		/* offset in file assoc. with buffer */
1320Sstevel@tonic-gate } buf_t;
1330Sstevel@tonic-gate 
1340Sstevel@tonic-gate /*
1350Sstevel@tonic-gate  * Bufhd structures used at the head of the hashed buffer queues.
1360Sstevel@tonic-gate  * We only need seven words for this, so this abbreviated
1370Sstevel@tonic-gate  * definition saves some space.
1380Sstevel@tonic-gate  */
1390Sstevel@tonic-gate struct diskhd {
1400Sstevel@tonic-gate 	int	b_flags;		/* not used, needed for consistency */
1410Sstevel@tonic-gate 	struct buf *b_forw, *b_back;	/* queue of unit queues */
1420Sstevel@tonic-gate 	struct buf *av_forw, *av_back;	/* queue of bufs for this unit */
1430Sstevel@tonic-gate 	o_dev_t	b_dev;			/* OLD major+minor device name */
1440Sstevel@tonic-gate 	size_t b_bcount;		/* transfer count */
1450Sstevel@tonic-gate };
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate /*
1490Sstevel@tonic-gate  * Statistics on the buffer cache
1500Sstevel@tonic-gate  */
1510Sstevel@tonic-gate struct biostats {
1520Sstevel@tonic-gate 	kstat_named_t	bio_lookup;	/* requests to assign buffer */
1530Sstevel@tonic-gate 	kstat_named_t	bio_hit;	/* buffer already associated with blk */
1540Sstevel@tonic-gate 	kstat_named_t	bio_bufwant;	/* kmem_allocs NOSLEEP failed new buf */
1550Sstevel@tonic-gate 	kstat_named_t	bio_bufwait;	/* kmem_allocs with KM_SLEEP for buf */
1560Sstevel@tonic-gate 	kstat_named_t	bio_bufbusy;	/* buffer locked by someone else */
1570Sstevel@tonic-gate 	kstat_named_t	bio_bufdup;	/* duplicate buffer found for block */
1580Sstevel@tonic-gate };
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate /*
1610Sstevel@tonic-gate  * These flags are kept in b_flags.
1620Sstevel@tonic-gate  * The first group is part of the DDI
1630Sstevel@tonic-gate  */
1640Sstevel@tonic-gate #define	B_BUSY		0x0001	/* not on av_forw/back list */
1650Sstevel@tonic-gate #define	B_DONE		0x0002	/* transaction finished */
1660Sstevel@tonic-gate #define	B_ERROR		0x0004	/* transaction aborted */
1670Sstevel@tonic-gate #define	B_PAGEIO	0x0010	/* do I/O to pages on bp->p_pages */
1680Sstevel@tonic-gate #define	B_PHYS		0x0020	/* Physical IO potentially using UNIBUS map */
1690Sstevel@tonic-gate #define	B_READ		0x0040	/* read when I/O occurs */
1700Sstevel@tonic-gate #define	B_WRITE		0x0100	/* non-read pseudo-flag */
1710Sstevel@tonic-gate 
1720Sstevel@tonic-gate /* Not part of the DDI */
1730Sstevel@tonic-gate #define	B_WANTED	0x0080		/* issue wakeup when BUSY goes off */
1740Sstevel@tonic-gate #define	B_AGE		0x000200	/* delayed write for correct aging */
1750Sstevel@tonic-gate #define	B_ASYNC		0x000400	/* don't wait for I/O completion */
1760Sstevel@tonic-gate #define	B_DELWRI	0x000800	/* delayed write-wait til buf needed */
1770Sstevel@tonic-gate #define	B_STALE		0x001000	/* on av_* list; invalid contents */
1780Sstevel@tonic-gate #define	B_DONTNEED	0x002000	/* after write, need not be cached */
1790Sstevel@tonic-gate #define	B_REMAPPED	0x004000	/* buffer is kernel addressable */
1800Sstevel@tonic-gate #define	B_FREE		0x008000	/* free page when done */
1810Sstevel@tonic-gate #define	B_INVAL		0x010000	/* does not contain valid info  */
1820Sstevel@tonic-gate #define	B_FORCE		0x020000	/* semi-permanent removal from cache */
1830Sstevel@tonic-gate #define	B_NOCACHE	0x080000 	/* don't cache block when released */
1840Sstevel@tonic-gate #define	B_TRUNC		0x100000	/* truncate page without I/O */
1850Sstevel@tonic-gate #define	B_SHADOW	0x200000	/* is b_shadow field valid? */
1860Sstevel@tonic-gate #define	B_RETRYWRI	0x400000	/* retry write til works or bfinval */
1870Sstevel@tonic-gate #define	B_FAILFAST	0x1000000	/* Fail promptly if device goes away */
1880Sstevel@tonic-gate #define	B_STARTED	0x2000000	/* io:::start probe called for buf */
1890Sstevel@tonic-gate #define	B_ABRWRITE	0x4000000	/* Application based recovery active */
1900Sstevel@tonic-gate 
1910Sstevel@tonic-gate /*
1920Sstevel@tonic-gate  * Insq/Remq for the buffer hash lists.
1930Sstevel@tonic-gate  */
1940Sstevel@tonic-gate #define	bremhash(bp) { \
1950Sstevel@tonic-gate 	ASSERT((bp)->b_forw != NULL); \
1960Sstevel@tonic-gate 	ASSERT((bp)->b_back != NULL); \
1970Sstevel@tonic-gate 	(bp)->b_back->b_forw = (bp)->b_forw; \
1980Sstevel@tonic-gate 	(bp)->b_forw->b_back = (bp)->b_back; \
1990Sstevel@tonic-gate 	(bp)->b_forw = (bp)->b_back = NULL; \
2000Sstevel@tonic-gate }
2010Sstevel@tonic-gate #define	binshash(bp, dp) { \
2020Sstevel@tonic-gate 	ASSERT((bp)->b_forw == NULL); \
2030Sstevel@tonic-gate 	ASSERT((bp)->b_back == NULL); \
2040Sstevel@tonic-gate 	ASSERT((dp)->b_forw != NULL); \
2050Sstevel@tonic-gate 	ASSERT((dp)->b_back != NULL); \
2060Sstevel@tonic-gate 	(bp)->b_forw = (dp)->b_forw; \
2070Sstevel@tonic-gate 	(bp)->b_back = (dp); \
2080Sstevel@tonic-gate 	(dp)->b_forw->b_back = (bp); \
2090Sstevel@tonic-gate 	(dp)->b_forw = (bp); \
2100Sstevel@tonic-gate }
2110Sstevel@tonic-gate 
2120Sstevel@tonic-gate 
2130Sstevel@tonic-gate /*
2140Sstevel@tonic-gate  * The hash structure maintains two lists:
2150Sstevel@tonic-gate  *
2160Sstevel@tonic-gate  * 	1) The hash list of buffers (b_forw & b_back)
2170Sstevel@tonic-gate  *	2) The LRU free list of buffers on this hash bucket (av_forw & av_back)
2180Sstevel@tonic-gate  *
2190Sstevel@tonic-gate  * The dwbuf structure keeps a list of delayed write buffers per hash bucket
2200Sstevel@tonic-gate  * hence there are exactly the same number of dwbuf structures as there are
2210Sstevel@tonic-gate  * the hash buckets (hbuf structures) in the system.
2220Sstevel@tonic-gate  *
2230Sstevel@tonic-gate  * The number of buffers on the freelist may not be equal to the number of
2240Sstevel@tonic-gate  * buffers on the hash list. That is because when buffers are busy they are
2250Sstevel@tonic-gate  * taken off the freelist but not off the hash list. "b_length" field keeps
2260Sstevel@tonic-gate  * track of the number of free buffers (including delayed writes ones) on
2270Sstevel@tonic-gate  * the hash bucket. The "b_lock" mutex protects the free list as well as
2280Sstevel@tonic-gate  * the hash list. It also protects the counter "b_length".
2290Sstevel@tonic-gate  *
2300Sstevel@tonic-gate  * Enties b_forw, b_back, av_forw & av_back must be at the same offset
2310Sstevel@tonic-gate  * as the ones in buf structure.
2320Sstevel@tonic-gate  */
2330Sstevel@tonic-gate struct	hbuf {
2340Sstevel@tonic-gate 	int	b_flags;
2350Sstevel@tonic-gate 
2360Sstevel@tonic-gate 	struct	buf	*b_forw;	/* hash list forw pointer */
2370Sstevel@tonic-gate 	struct	buf	*b_back;	/* hash list back pointer */
2380Sstevel@tonic-gate 
2390Sstevel@tonic-gate 	struct	buf	*av_forw;	/* free list forw pointer */
2400Sstevel@tonic-gate 	struct	buf	*av_back;	/* free list back pointer */
2410Sstevel@tonic-gate 
2420Sstevel@tonic-gate 	int		b_length;	/* # of entries on free list */
2430Sstevel@tonic-gate 	kmutex_t	b_lock;		/* lock to protect this structure */
2440Sstevel@tonic-gate };
2450Sstevel@tonic-gate 
2460Sstevel@tonic-gate 
2470Sstevel@tonic-gate /*
2480Sstevel@tonic-gate  * The delayed list pointer entries should match with the buf strcuture.
2490Sstevel@tonic-gate  */
2500Sstevel@tonic-gate struct	dwbuf {
2510Sstevel@tonic-gate 	int	b_flags;		/* not used */
2520Sstevel@tonic-gate 
2530Sstevel@tonic-gate 	struct	buf	*b_forw;	/* not used */
2540Sstevel@tonic-gate 	struct	buf	*b_back;	/* not used */
2550Sstevel@tonic-gate 
2560Sstevel@tonic-gate 	struct	buf	*av_forw;	/* delayed write forw pointer */
2570Sstevel@tonic-gate 	struct	buf	*av_back;	/* delayed write back pointer */
2580Sstevel@tonic-gate };
2590Sstevel@tonic-gate 
2600Sstevel@tonic-gate 
2610Sstevel@tonic-gate /*
2620Sstevel@tonic-gate  * Unlink a buffer from the available (free or delayed write) list and mark
2630Sstevel@tonic-gate  * it busy (internal interface).
2640Sstevel@tonic-gate  */
2650Sstevel@tonic-gate #define	notavail(bp) \
2660Sstevel@tonic-gate {\
2670Sstevel@tonic-gate 	ASSERT(SEMA_HELD(&bp->b_sem)); \
2680Sstevel@tonic-gate 	ASSERT((bp)->av_forw != NULL); \
2690Sstevel@tonic-gate 	ASSERT((bp)->av_back != NULL); \
2700Sstevel@tonic-gate 	ASSERT((bp)->av_forw != (bp)); \
2710Sstevel@tonic-gate 	ASSERT((bp)->av_back != (bp)); \
2720Sstevel@tonic-gate 	(bp)->av_back->av_forw = (bp)->av_forw; \
2730Sstevel@tonic-gate 	(bp)->av_forw->av_back = (bp)->av_back; \
2740Sstevel@tonic-gate 	(bp)->b_flags |= B_BUSY; \
2750Sstevel@tonic-gate 	(bp)->av_forw = (bp)->av_back = NULL; \
2760Sstevel@tonic-gate }
2770Sstevel@tonic-gate 
2780Sstevel@tonic-gate #if defined(_KERNEL)
2790Sstevel@tonic-gate /*
2800Sstevel@tonic-gate  * Macros to avoid the extra function call needed for binary compat.
2810Sstevel@tonic-gate  *
2820Sstevel@tonic-gate  * B_RETRYWRI is not included in clear_flags for BWRITE(), BWRITE2(),
2830Sstevel@tonic-gate  * or brwrite() so that the retry operation is persistent until the
2840Sstevel@tonic-gate  * write either succeeds or the buffer is bfinval()'d.
2850Sstevel@tonic-gate  *
2860Sstevel@tonic-gate  */
2870Sstevel@tonic-gate #define	BREAD(dev, blkno, bsize) \
2880Sstevel@tonic-gate 	bread_common(/* ufsvfsp */ NULL, dev, blkno, bsize)
2890Sstevel@tonic-gate 
2900Sstevel@tonic-gate #define	BWRITE(bp) \
2910Sstevel@tonic-gate 	bwrite_common(/* ufsvfsp */ NULL, bp, /* force_wait */ 0, \
2920Sstevel@tonic-gate 		/* do_relse */ 1, \
2930Sstevel@tonic-gate 		/* clear_flags */ (B_READ | B_DONE | B_ERROR | B_DELWRI))
2940Sstevel@tonic-gate 
2950Sstevel@tonic-gate #define	BWRITE2(bp) \
2960Sstevel@tonic-gate 	bwrite_common(/* ufsvfsp */ NULL, bp, /* force_wait */ 1, \
2970Sstevel@tonic-gate 		/* do_relse */ 0, \
2980Sstevel@tonic-gate 		/* clear_flags */ (B_READ | B_DONE | B_ERROR | B_DELWRI))
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate #define	GETBLK(dev, blkno, bsize) \
3010Sstevel@tonic-gate 	getblk_common(/* ufsvfsp */ NULL, dev, blkno, bsize, /* errflg */ 0)
3020Sstevel@tonic-gate 
3030Sstevel@tonic-gate 
3040Sstevel@tonic-gate /*
3050Sstevel@tonic-gate  * Macros for new retry write interfaces.
3060Sstevel@tonic-gate  */
3070Sstevel@tonic-gate 
3080Sstevel@tonic-gate /*
3090Sstevel@tonic-gate  * Same as bdwrite() except write failures are retried.
3100Sstevel@tonic-gate  */
3110Sstevel@tonic-gate #define	bdrwrite(bp) { \
3120Sstevel@tonic-gate 	(bp)->b_flags |= B_RETRYWRI; \
3130Sstevel@tonic-gate 	bdwrite((bp)); \
3140Sstevel@tonic-gate }
3150Sstevel@tonic-gate 
3160Sstevel@tonic-gate /*
3170Sstevel@tonic-gate  * Same as bwrite() except write failures are retried.
3180Sstevel@tonic-gate  */
3190Sstevel@tonic-gate #define	brwrite(bp) { \
3200Sstevel@tonic-gate 	(bp)->b_flags |= B_RETRYWRI; \
3210Sstevel@tonic-gate 	bwrite_common((bp), /* force_wait */ 0, /* do_relse */ 1, \
3220Sstevel@tonic-gate 		/* clear_flags */ (B_READ | B_DONE | B_ERROR | B_DELWRI)); \
3230Sstevel@tonic-gate }
3240Sstevel@tonic-gate 
3250Sstevel@tonic-gate extern struct hbuf	*hbuf;		/* Hash table */
3260Sstevel@tonic-gate extern struct dwbuf	*dwbuf;		/* delayed write hash table */
3270Sstevel@tonic-gate extern struct buf	*buf;		/* The buffer pool itself */
3280Sstevel@tonic-gate extern struct buf	bfreelist;	/* head of available list */
3290Sstevel@tonic-gate 
3300Sstevel@tonic-gate extern void (*bio_lufs_strategy)(void *, buf_t *);	/* UFS Logging */
3310Sstevel@tonic-gate extern void (*bio_snapshot_strategy)(void *, buf_t *);	/* UFS snapshots */
3320Sstevel@tonic-gate 
3330Sstevel@tonic-gate int	bcheck(dev_t, struct buf *);
3340Sstevel@tonic-gate int	iowait(struct buf *);
3350Sstevel@tonic-gate int	hash2ints(int x, int y);
3360Sstevel@tonic-gate int	bio_busy(int);
3370Sstevel@tonic-gate int	biowait(struct buf *);
3380Sstevel@tonic-gate int	biomodified(struct buf *);
3390Sstevel@tonic-gate int	geterror(struct buf *);
3400Sstevel@tonic-gate void	minphys(struct buf *);
3410Sstevel@tonic-gate /*
3420Sstevel@tonic-gate  * ufsvfsp is declared as a void * to avoid having everyone that uses
3430Sstevel@tonic-gate  * this header file include sys/fs/ufs_inode.h.
3440Sstevel@tonic-gate  */
3450Sstevel@tonic-gate void	bwrite_common(void *ufsvfsp, struct buf *, int force_wait,
3460Sstevel@tonic-gate 	int do_relse, int clear_flags);
3470Sstevel@tonic-gate void	bwrite(struct buf *);
3480Sstevel@tonic-gate void	bwrite2(struct buf *);
3490Sstevel@tonic-gate void	bdwrite(struct buf *);
3500Sstevel@tonic-gate void	bawrite(struct buf *);
3510Sstevel@tonic-gate void	brelse(struct buf *);
3520Sstevel@tonic-gate void	iodone(struct buf *);
3530Sstevel@tonic-gate void	clrbuf(struct buf *);
3540Sstevel@tonic-gate void	bflush(dev_t);
3550Sstevel@tonic-gate void	blkflush(dev_t, daddr_t);
3560Sstevel@tonic-gate void	binval(dev_t);
3570Sstevel@tonic-gate int	bfinval(dev_t, int);
3580Sstevel@tonic-gate void	binit(void);
3590Sstevel@tonic-gate void	biodone(struct buf *);
3600Sstevel@tonic-gate void	bioinit(struct buf *);
3610Sstevel@tonic-gate void	biofini(struct buf *);
3620Sstevel@tonic-gate void	bp_mapin(struct buf *);
3630Sstevel@tonic-gate void	*bp_mapin_common(struct buf *, int);
3640Sstevel@tonic-gate void	bp_mapout(struct buf *);
365*5251Smrj int	bp_copyin(struct buf *, void *, offset_t, size_t);
366*5251Smrj int	bp_copyout(void *, struct buf *, offset_t, size_t);
3670Sstevel@tonic-gate void	bp_init(size_t, uint_t);
3680Sstevel@tonic-gate int	bp_color(struct buf *);
3690Sstevel@tonic-gate void	pageio_done(struct buf *);
3700Sstevel@tonic-gate struct buf *bread(dev_t, daddr_t, long);
3710Sstevel@tonic-gate struct buf *bread_common(void *, dev_t, daddr_t, long);
3720Sstevel@tonic-gate struct buf *breada(dev_t, daddr_t, daddr_t, long);
3730Sstevel@tonic-gate struct buf *getblk(dev_t, daddr_t, long);
3740Sstevel@tonic-gate struct buf *getblk_common(void *, dev_t, daddr_t, long, int);
3750Sstevel@tonic-gate struct buf *ngeteblk(long);
3760Sstevel@tonic-gate struct buf *geteblk(void);
3770Sstevel@tonic-gate struct buf *pageio_setup(struct page *, size_t, struct vnode *, int);
3780Sstevel@tonic-gate void bioerror(struct buf *bp, int error);
3790Sstevel@tonic-gate void bioreset(struct buf *bp);
3800Sstevel@tonic-gate struct buf *bioclone(struct buf *, off_t, size_t, dev_t, daddr_t,
3810Sstevel@tonic-gate 	int (*)(struct buf *), struct buf *, int);
3820Sstevel@tonic-gate size_t	biosize(void);
3830Sstevel@tonic-gate #endif	/* defined(_KERNEL) */
3840Sstevel@tonic-gate 
3850Sstevel@tonic-gate #ifdef	__cplusplus
3860Sstevel@tonic-gate }
3870Sstevel@tonic-gate #endif
3880Sstevel@tonic-gate 
3890Sstevel@tonic-gate #endif	/* _SYS_BUF_H */
390