diff options
author | phk <phk@FreeBSD.org> | 2001-04-18 07:16:07 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2001-04-18 07:16:07 +0000 |
commit | 11bb4116b321bf5d9a23c40cb6df129889596147 (patch) | |
tree | 3e04fb63c897405eb31d8cfcf2498dfcf5df9f55 /sys/kern | |
parent | 60035bdf1f8e7acd2360f708648e9223a56efdb0 (diff) | |
download | FreeBSD-src-11bb4116b321bf5d9a23c40cb6df129889596147.zip FreeBSD-src-11bb4116b321bf5d9a23c40cb6df129889596147.tar.gz |
bread() is a special case of breadn(), so don't replicate code.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_bio.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 316cef6..c1b53d8 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -502,35 +502,14 @@ bremfree(struct buf * bp) * Get a buffer with the specified data. Look in the cache first. 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 ( see - * getblk() ). + * getblk() ). This is really just a special case of breadn(). */ int bread(struct vnode * vp, daddr_t blkno, int size, struct ucred * cred, struct buf ** bpp) { - struct buf *bp; - - bp = getblk(vp, blkno, size, 0, 0); - *bpp = bp; - /* if not found in cache, do some I/O */ - if ((bp->b_flags & B_CACHE) == 0) { - if (curproc != PCPU_GET(idleproc)) - curproc->p_stats->p_ru.ru_inblock++; - KASSERT(!(bp->b_flags & B_ASYNC), ("bread: illegal async bp %p", bp)); - bp->b_iocmd = BIO_READ; - bp->b_flags &= ~B_INVAL; - bp->b_ioflags &= ~BIO_ERROR; - if (bp->b_rcred == NOCRED) { - if (cred != NOCRED) - crhold(cred); - bp->b_rcred = cred; - } - vfs_busy_pages(bp, 0); - VOP_STRATEGY(vp, bp); - return (bufwait(bp)); - } - return (0); + return (breadn(vp, blkno, size, 0, 0, 0, cred, bpp)); } /* |