diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 2000-05-01 19:38:51 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 2000-05-01 19:38:51 +0000 |
commit | e4057dbdb09486d58a379d3f428d4f7a73910e26 (patch) | |
tree | 50189489669d4efb31d422ea669ade8331d1cc48 /sys/vm/vm_pager.c | |
parent | 23f282aa31e9b6fceacd449020e936e98d6f2298 (diff) | |
download | src-e4057dbdb09486d58a379d3f428d4f7a73910e26.tar.gz src-e4057dbdb09486d58a379d3f428d4f7a73910e26.zip |
Move and staticize the bufchain functions so they become local to the
only piece of code using them. This will ease a rewrite of them.
Notes
Notes:
svn path=/head/; revision=59866
Diffstat (limited to 'sys/vm/vm_pager.c')
-rw-r--r-- | sys/vm/vm_pager.c | 133 |
1 files changed, 0 insertions, 133 deletions
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index bf09d24f1bd6..84e61652a8b9 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -472,136 +472,3 @@ relpbuf(bp, pfreecnt) } splx(s); } - -/******************************************************** - * CHAINING FUNCTIONS * - ******************************************************** - * - * These functions support recursion of I/O operations - * on bp's, typically by chaining one or more 'child' bp's - * to the parent. Synchronous, asynchronous, and semi-synchronous - * chaining is possible. - */ - -/* - * vm_pager_chain_iodone: - * - * io completion routine for child bp. Currently we fudge a bit - * on dealing with b_resid. Since users of these routines may issue - * multiple children simultaneously, sequencing of the error can be lost. - */ - -static void -vm_pager_chain_iodone(struct buf *nbp) -{ - struct buf *bp; - - if ((bp = nbp->b_chain.parent) != NULL) { - if (nbp->b_ioflags & BIO_ERROR) { - bp->b_ioflags |= BIO_ERROR; - bp->b_error = nbp->b_error; - } else if (nbp->b_resid != 0) { - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EINVAL; - } else { - bp->b_resid -= nbp->b_bcount; - } - nbp->b_chain.parent = NULL; - --bp->b_chain.count; - if (bp->b_flags & B_WANT) { - bp->b_flags &= ~B_WANT; - wakeup(bp); - } - if (!bp->b_chain.count && (bp->b_flags & B_AUTOCHAINDONE)) { - bp->b_flags &= ~B_AUTOCHAINDONE; - if (bp->b_resid != 0 && !(bp->b_ioflags & BIO_ERROR)) { - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EINVAL; - } - bufdone(bp); - } - } - nbp->b_flags |= B_DONE; - nbp->b_flags &= ~B_ASYNC; - relpbuf(nbp, NULL); -} - -/* - * getchainbuf: - * - * Obtain a physical buffer and chain it to its parent buffer. When - * I/O completes, the parent buffer will be B_SIGNAL'd. Errors are - * automatically propagated to the parent - */ - -struct buf * -getchainbuf(struct buf *bp, struct vnode *vp, int flags) -{ - struct buf *nbp = getpbuf(NULL); - - nbp->b_chain.parent = bp; - ++bp->b_chain.count; - - if (bp->b_chain.count > 4) - waitchainbuf(bp, 4, 0); - - nbp->b_ioflags = bp->b_ioflags & BIO_ORDERED; - nbp->b_flags = flags; - nbp->b_rcred = nbp->b_wcred = proc0.p_ucred; - nbp->b_iodone = vm_pager_chain_iodone; - - crhold(nbp->b_rcred); - crhold(nbp->b_wcred); - - if (vp) - pbgetvp(vp, nbp); - return(nbp); -} - -void -flushchainbuf(struct buf *nbp) -{ - if (nbp->b_bcount) { - nbp->b_bufsize = nbp->b_bcount; - if (nbp->b_iocmd == BIO_WRITE) - nbp->b_dirtyend = nbp->b_bcount; - BUF_KERNPROC(nbp); - BUF_STRATEGY(nbp); - } else { - bufdone(nbp); - } -} - -void -waitchainbuf(struct buf *bp, int count, int done) -{ - int s; - - s = splbio(); - while (bp->b_chain.count > count) { - bp->b_flags |= B_WANT; - tsleep(bp, PRIBIO + 4, "bpchain", 0); - } - if (done) { - if (bp->b_resid != 0 && !(bp->b_ioflags & BIO_ERROR)) { - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EINVAL; - } - bufdone(bp); - } - splx(s); -} - -void -autochaindone(struct buf *bp) -{ - int s; - - s = splbio(); - if (bp->b_chain.count == 0) - bufdone(bp); - else - bp->b_flags |= B_AUTOCHAINDONE; - splx(s); -} - |