diff options
author | phk <phk@FreeBSD.org> | 2004-03-11 18:02:36 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-03-11 18:02:36 +0000 |
commit | 2a5e157787a7e1d72f1b7fd7d1ecb1e91b9e5251 (patch) | |
tree | 24546ef169a9ce1a21318822c62c8a981c08e1a7 /sys/kern | |
parent | 9ba3cede82df59c4fc45ffe6b8f44950eef74c6b (diff) | |
download | FreeBSD-src-2a5e157787a7e1d72f1b7fd7d1ecb1e91b9e5251.zip FreeBSD-src-2a5e157787a7e1d72f1b7fd7d1ecb1e91b9e5251.tar.gz |
Properly vector all bwrite() and BUF_WRITE() calls through the same path
and s/BUF_WRITE()/bwrite()/ since it now does the same as bwrite().
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_bio.c | 32 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 6 |
2 files changed, 24 insertions, 14 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index f026caa..bba9a55 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -61,9 +61,11 @@ static MALLOC_DEFINE(M_BIOBUF, "BIO buffer", "BIO buffer"); struct bio_ops bioops; /* I/O operation notification */ +static int ibwrite(struct buf *); + struct buf_ops buf_ops_bio = { "buf_ops_bio", - bwrite + ibwrite }; /* @@ -760,10 +762,18 @@ breadn(struct vnode * vp, daddr_t blkno, int size, * or in biodone() since the I/O is synchronous. We put it * here. */ - int bwrite(struct buf * bp) { + + KASSERT(bp->b_op != NULL && bp->b_op->bop_write != NULL, + ("Martian buffer %p in bwrite: nobody to write it.", bp)); + return (bp->b_op->bop_write(bp)); +} + +static int +ibwrite(struct buf * bp) +{ int oldflags, s; struct buf *newbp; @@ -775,7 +785,7 @@ bwrite(struct buf * bp) oldflags = bp->b_flags; if (BUF_REFCNT(bp) == 0) - panic("bwrite: buffer is not busy???"); + panic("ibwrite: buffer is not busy???"); s = splbio(); /* * If a background write is already in progress, delay @@ -793,7 +803,7 @@ bwrite(struct buf * bp) bp->b_vflags |= BV_BKGRDWAIT; msleep(&bp->b_xflags, VI_MTX(bp->b_vp), PRIBIO, "bwrbg", 0); if (bp->b_vflags & BV_BKGRDINPROG) - panic("bwrite: still writing"); + panic("ibwrite: still writing"); } VI_UNLOCK(bp->b_vp); @@ -814,7 +824,7 @@ bwrite(struct buf * bp) !buf_dirty_count_severe()) { if (bp->b_iodone != NULL) { printf("bp->b_iodone = %p\n", bp->b_iodone); - panic("bwrite: need chained iodone"); + panic("ibwrite: need chained iodone"); } /* get a new block */ @@ -1147,7 +1157,7 @@ void bawrite(struct buf * bp) { bp->b_flags |= B_ASYNC; - (void) BUF_WRITE(bp); + (void) bwrite(bp); } /* @@ -1710,7 +1720,7 @@ vfs_bio_awrite(struct buf * bp) * XXX returns b_bufsize instead of b_bcount for nwritten? */ nwritten = bp->b_bufsize; - (void) BUF_WRITE(bp); + (void) bwrite(bp); return nwritten; } @@ -2382,7 +2392,7 @@ vfs_setdirty(struct buf *bp) * case it is returned with B_INVAL clear and B_CACHE set based on the * backing VM. * - * getblk() also forces a BUF_WRITE() for any B_DELWRI buffer whos + * getblk() also forces a bwrite() for any B_DELWRI buffer whos * B_CACHE bit is clear. * * What this means, basically, is that the caller should use B_CACHE to @@ -2474,7 +2484,7 @@ loop: (size > bp->b_kvasize)) { if (bp->b_flags & B_DELWRI) { bp->b_flags |= B_NOCACHE; - BUF_WRITE(bp); + bwrite(bp); } else { if ((bp->b_flags & B_VMIO) && (LIST_FIRST(&bp->b_dep) == NULL)) { @@ -2482,7 +2492,7 @@ loop: brelse(bp); } else { bp->b_flags |= B_NOCACHE; - BUF_WRITE(bp); + bwrite(bp); } } goto loop; @@ -2531,7 +2541,7 @@ loop: if ((bp->b_flags & (B_CACHE|B_DELWRI)) == B_DELWRI) { bp->b_flags |= B_NOCACHE; - BUF_WRITE(bp); + bwrite(bp); goto loop; } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 2849cf9..ee4208a 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1028,7 +1028,7 @@ flushbuflist(blist, flags, vp, slpflag, slptimeo, errorp) * believe there is a slight chance that a delayed * write will occur while sleeping just above, so * check for it. Note that vfs_bio_awrite expects - * buffers to reside on a queue, while BUF_WRITE and + * buffers to reside on a queue, while bwrite and * brelse do not. */ if (((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI) && @@ -1040,11 +1040,11 @@ flushbuflist(blist, flags, vp, slpflag, slptimeo, errorp) } else { bremfree(bp); bp->b_flags |= B_ASYNC; - BUF_WRITE(bp); + bwrite(bp); } } else { bremfree(bp); - (void) BUF_WRITE(bp); + (void) bwrite(bp); } goto done; } |