-/*
- * Find the block in the buffer pool.
- * If the buffer is not present, allocate a new buffer and load
- * its contents according to the filesystem fill routine.
- */
-bread(vp, blkno, size, cred, bpp)
- struct vnode *vp;
- daddr_t blkno;
- int size;
- struct ucred *cred;
- struct buf **bpp;
-#ifdef SECSIZE
- long secsize;
-#endif SECSIZE
-{
- struct proc *p = curproc; /* XXX */
- register struct buf *bp;
-
- if (size == 0)
- panic("bread: size 0");
-#ifdef SECSIZE
- bp = getblk(dev, blkno, size, secsize);
-#else SECSIZE
- *bpp = bp = getblk(vp, blkno, size, 0, 0);
-#endif SECSIZE
- if (bp->b_flags & (B_DONE | B_DELWRI)) {
- trace(TR_BREADHIT, pack(vp, size), blkno);
- return (0);
- }
- bp->b_flags |= B_READ;
- if (bp->b_bcount > bp->b_bufsize)
- panic("bread");
- if (bp->b_rcred == NOCRED && cred != NOCRED) {
- crhold(cred);
- bp->b_rcred = cred;
- }
- VOP_STRATEGY(bp);
- trace(TR_BREADMISS, pack(vp, size), blkno);
- p->p_stats->p_ru.ru_inblock++; /* pay for read */
- return (biowait(bp));
-}
-
-/*
- * Operates like bread, but also starts I/O on the N specified
- * read-ahead blocks.
- */
-breadn(vp, blkno, size, rablkno, rabsize, num, cred, bpp)
- struct vnode *vp;
- daddr_t blkno; int size;
-#ifdef SECSIZE
- long secsize;
-#endif SECSIZE
- daddr_t rablkno[]; int rabsize[];
- int num;
- struct ucred *cred;
- struct buf **bpp;