FreeBSD/sys/kern/vfs_bio.c
/*
 * Attempt to initiate asynchronous I/O on read-ahead blocks.  We must
 * clear BIO_ERROR and B_INVAL prior to initiating I/O . If B_CACHE is set,
 * the buffer is valid and we do not have to do anything.
 */
Attempt to initiate asynchronous I/O on read-ahead blocks.  We must
clear BIO_ERROR and B_INVAL prior to initiating I/O . If B_CACHE is set,
the buffer is valid and we do not have to do anything.
Attempt to initiate asynchronous I / O on read - ahead blocks . We must clear BIO_ERROR and B_INVAL prior to initiating I / O . If B_CACHE is set the buffer is valid and we do not have to do anything .
void
breada(struct vnode * vp, daddr_t * rablkno, int * rabsize,
    int cnt, struct ucred * cred)
{
	struct buf *rabp;
	int i;
	for (i = 0; i < cnt; i++, rablkno++, rabsize++) {
		if (inmem(vp, *rablkno))
			continue;
		rabp = getblk(vp, *rablkno, *rabsize, 0, 0, 0);
		if ((rabp->b_flags & B_CACHE) == 0) {
			if (!TD_IS_IDLETHREAD(curthread)) {
#ifdef RACCT
				if (racct_enable) {
					PROC_LOCK(curproc);
					racct_add_buf(curproc, rabp, 0);
					PROC_UNLOCK(curproc);
				}
#endif 
				curthread->td_ru.ru_inblock++;
			}
			rabp->b_flags |= B_ASYNC;
			rabp->b_flags &= ~B_INVAL;
			rabp->b_ioflags &= ~BIO_ERROR;
			rabp->b_iocmd = BIO_READ;
			if (rabp->b_rcred == NOCRED && cred != NOCRED)
				rabp->b_rcred = crhold(cred);
			vfs_busy_pages(rabp, 0);
			BUF_KERNPROC(rabp);
			rabp->b_iooffset = dbtob(rabp->b_blkno);
			bstrategy(rabp);
		} else {
			brelse(rabp);
		}
	}
}
void breada ( struct vnode * vp , daddr_t * rablkno , int * rabsize , int cnt , struct ucred * cred ) { struct buf * rabp ; int i ; for ( i = 0 ; i < cnt ; i ++ , rablkno ++ , rabsize ++ ) { if ( inmem ( vp , * rablkno ) ) continue ; rabp = getblk ( vp , * rablkno , * rabsize , 0 , 0 , 0 ) ; if ( ( rabp -> b_flags & B_CACHE ) == 0 ) { if ( ! TD_IS_IDLETHREAD ( curthread ) ) { #ifdef RACCT if ( racct_enable ) { PROC_LOCK ( curproc ) ; racct_add_buf ( curproc , rabp , 0 ) ; PROC_UNLOCK ( curproc ) ; } #endif curthread -> td_ru . ru_inblock ++ ; } rabp -> b_flags |= B_ASYNC ; rabp -> b_flags &= ~ B_INVAL ; rabp -> b_ioflags &= ~ BIO_ERROR ; rabp -> b_iocmd = BIO_READ ; if ( rabp -> b_rcred == NOCRED && cred != NOCRED ) rabp -> b_rcred = crhold ( cred ) ; vfs_busy_pages ( rabp , 0 ) ; BUF_KERNPROC ( rabp ) ; rabp -> b_iooffset = dbtob ( rabp -> b_blkno ) ; bstrategy ( rabp ) ; } else { brelse ( rabp ) ; } } }
Attempt to initiate asynchronous I/O on read-ahead blocks.
Attempt to initiate asynchronous I / O on read - ahead blocks .
/* RACCT */