summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-11-30 05:45:34 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>2001-11-30 05:45:34 +0000
commit19af97d4ea8b7333876192a8643e598e1f191781 (patch)
treeefdd30fb782ddda391d9a4f3c55e51ebe0ca54fb /sys
parentd41b705df378eb48538e74ca17789e48e436a321 (diff)
Call buf_cleanout, which handles wakeups
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_bio.c15
-rw-r--r--sys/kern/vfs_default.c8
-rw-r--r--sys/nfs/nfs_bio.c8
-rw-r--r--sys/sys/buf.h4
-rw-r--r--sys/uvm/uvm_pager.c4
-rw-r--r--sys/uvm/uvm_swap.c11
6 files changed, 29 insertions, 21 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 6a79db9bb1e..52be1533b43 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_bio.c,v 1.53 2001/11/27 06:21:37 art Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.54 2001/11/30 05:45:33 csapuntz Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*-
@@ -1063,3 +1063,16 @@ vfs_bufstats()
splx(s);
}
#endif /* DEBUG */
+
+int
+buf_cleanout(struct buf *bp) {
+ if (bp->b_vp != NULL)
+ brelvp(bp);
+
+ if (bp->b_flags & B_WANTED) {
+ bp->b_flags &= ~B_WANTED;
+ wakeup(bp);
+ }
+
+ return (0);
+}
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index ff314d589ab..c7de1c4dcae 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_default.c,v 1.11 2001/11/29 15:51:48 art Exp $ */
+/* $OpenBSD: vfs_default.c,v 1.12 2001/11/30 05:45:33 csapuntz Exp $ */
/*
* Portions of this code are:
@@ -690,9 +690,7 @@ loopdone:
error = biowait(mbp);
}
s = splbio();
- if (mbp->b_vp != NULL) {
- brelvp(mbp);
- }
+ (void) buf_cleanout(mbp);
pool_put(&bufpool, mbp);
splx(s);
uvm_pagermapout(kva, npages);
@@ -971,8 +969,8 @@ genfs_putpages(v)
s = splbio();
if (mbp->b_vp) {
vwakeup(mbp->b_vp);
- brelvp(mbp);
}
+ buf_cleanout(mbp);
pool_put(&bufpool, mbp);
splx(s);
uvm_pagermapout(kva, npages);
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index d7ad1956b09..c995372a203 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_bio.c,v 1.28 2001/11/29 12:24:28 art Exp $ */
+/* $OpenBSD: nfs_bio.c,v 1.29 2001/11/30 05:45:33 csapuntz Exp $ */
/* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */
/*
@@ -867,9 +867,7 @@ loopdone:
error = biowait(mbp);
}
s = splbio();
- if (mbp->b_vp != NULL) {
- brelvp(mbp);
- }
+ (void) buf_cleanout(mbp);
pool_put(&bufpool, mbp);
splx(s);
uvm_pagermapout(kva, npages);
@@ -1118,8 +1116,8 @@ nfs_putpages(v)
s = splbio();
if (mbp->b_vp) {
vwakeup(mbp->b_vp);
- brelvp(mbp);
}
+ (void) buf_cleanout(mbp);
pool_put(&bufpool, mbp);
splx(s);
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index 48e64c438ee..bf752691c3c 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.35 2001/11/27 06:21:37 art Exp $ */
+/* $OpenBSD: buf.h,v 1.36 2001/11/30 05:45:33 csapuntz Exp $ */
/* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */
/*
@@ -266,6 +266,8 @@ int cluster_read __P((struct vnode *, struct cluster_info *,
u_quad_t, daddr_t, long, struct ucred *, struct buf **));
void cluster_write __P((struct buf *, struct cluster_info *, u_quad_t));
+int buf_cleanout(struct buf *bp);
+
__END_DECLS
#endif
#endif /* !_SYS_BUF_H_ */
diff --git a/sys/uvm/uvm_pager.c b/sys/uvm/uvm_pager.c
index fa627e06518..5d7c5e4dab2 100644
--- a/sys/uvm/uvm_pager.c
+++ b/sys/uvm/uvm_pager.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pager.c,v 1.26 2001/11/29 01:59:19 art Exp $ */
+/* $OpenBSD: uvm_pager.c,v 1.27 2001/11/30 05:45:33 csapuntz Exp $ */
/* $NetBSD: uvm_pager.c,v 1.48 2001/06/23 20:47:44 chs Exp $ */
/*
@@ -877,8 +877,8 @@ freed:
if (write && (bp->b_flags & B_AGE) != 0) {
vwakeup(bp->b_vp);
}
- brelvp(bp);
}
+ (void) buf_cleanout(bp);
pool_put(&bufpool, bp);
splx(s);
}
diff --git a/sys/uvm/uvm_swap.c b/sys/uvm/uvm_swap.c
index 95ecb9e7828..2fb9de02cde 100644
--- a/sys/uvm/uvm_swap.c
+++ b/sys/uvm/uvm_swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_swap.c,v 1.44 2001/11/28 19:28:15 art Exp $ */
+/* $OpenBSD: uvm_swap.c,v 1.45 2001/11/30 05:45:33 csapuntz Exp $ */
/* $NetBSD: uvm_swap.c,v 1.52 2001/05/26 16:32:47 chs Exp $ */
/*
@@ -1503,9 +1503,7 @@ sw_reg_iodone(bp)
/*
* disassociate this buffer from the vnode (if any).
*/
- if (vbp->vb_buf.b_vp != NULL) {
- brelvp(&vbp->vb_buf);
- }
+ (void) buf_cleanout(&vbp->vb_buf);
/*
* kill vbp structure
@@ -2030,11 +2028,10 @@ uvm_swap_io(pps, startslot, npages, flags)
* now dispose of the buf
*/
s = splbio();
- if (bp->b_vp)
- brelvp(bp);
-
if (write && bp->b_vp)
vwakeup(bp->b_vp);
+
+ (void) buf_cleanout(bp);
pool_put(&bufpool, bp);
splx(s);