summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_bio.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-07-23 18:49:48 +0000
committerdg <dg@FreeBSD.org>1995-07-23 18:49:48 +0000
commit1bda950a5894edf6410dbfffc74886cae83e25e8 (patch)
treee8e0501dfa383eb0e9dea4ec915ef8e9a8f3a5d9 /sys/kern/vfs_bio.c
parentf4f993838bff39735f1d0e78de51d2c2e3fe97cc (diff)
downloadFreeBSD-src-1bda950a5894edf6410dbfffc74886cae83e25e8.zip
FreeBSD-src-1bda950a5894edf6410dbfffc74886cae83e25e8.tar.gz
Fixed two cases where some parans were missing, resulting in some bogus
logic. Slightly simplified allocbuf().
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r--sys/kern/vfs_bio.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 6d6697f..3f5e3b6 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: vfs_bio.c,v 1.49 1995/07/17 06:26:07 davidg Exp $
+ * $Id: vfs_bio.c,v 1.50 1995/07/21 04:55:45 davidg Exp $
*/
/*
@@ -383,7 +383,7 @@ brelse(struct buf * bp)
/* anyone need this block? */
if (bp->b_flags & B_WANTED) {
- bp->b_flags &= ~B_WANTED | B_AGE;
+ bp->b_flags &= ~(B_WANTED | B_AGE);
wakeup((caddr_t) bp);
} else if (bp->b_flags & B_VMIO) {
bp->b_flags &= ~B_WANTED;
@@ -546,7 +546,8 @@ vfs_bio_awrite(struct buf * bp)
for (i = 1; i < MAXPHYS / size; i++) {
if ((bpa = incore(vp, lblkno + i)) &&
- ((bpa->b_flags & (B_BUSY | B_DELWRI | B_BUSY | B_CLUSTEROK | B_INVAL)) == B_DELWRI | B_CLUSTEROK) &&
+ ((bpa->b_flags & (B_BUSY | B_DELWRI | B_CLUSTEROK | B_INVAL)) ==
+ (B_DELWRI | B_CLUSTEROK)) &&
(bpa->b_bufsize == size)) {
if ((bpa->b_blkno == bpa->b_lblkno) ||
(bpa->b_blkno != bp->b_blkno + (i * size) / DEV_BSIZE))
@@ -835,7 +836,13 @@ loop:
* check for size inconsistancies
*/
if (bp->b_bcount != size) {
- allocbuf(bp, size);
+ if (bp->b_flags & B_VMIO) {
+ allocbuf(bp, size);
+ } else {
+ bp->b_flags |= B_NOCACHE;
+ VOP_BWRITE(bp);
+ goto loop;
+ }
}
splx(s);
return (bp);
@@ -1035,6 +1042,7 @@ allocbuf(struct buf * bp, int size)
vm_page_activate(m);
m->act_count = 0;
m->valid = 0;
+ bp->b_flags &= ~B_CACHE;
} else if (m->flags & PG_BUSY) {
int j;
@@ -1071,20 +1079,10 @@ allocbuf(struct buf * bp, int size)
bp->b_pages[pageindex] = m;
curbpnpages = pageindex + 1;
}
- if (bsize >= PAGE_SIZE) {
- for (i = bp->b_npages; i < curbpnpages; i++) {
- m = bp->b_pages[i];
- if (m->valid == 0) {
- bp->b_flags &= ~B_CACHE;
- }
- m->bmapped++;
- PAGE_WAKEUP(m);
- }
- } else {
- if (!vm_page_is_valid(bp->b_pages[0], off, bsize))
- bp->b_flags &= ~B_CACHE;
- bp->b_pages[0]->bmapped++;
- PAGE_WAKEUP(bp->b_pages[0]);
+ for (i = bp->b_npages; i < curbpnpages; i++) {
+ m = bp->b_pages[i];
+ m->bmapped++;
+ PAGE_WAKEUP(m);
}
bp->b_npages = curbpnpages;
bp->b_data = buffers_kva + (bp - buf) * MAXBSIZE;
OpenPOWER on IntegriCloud