summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2008-11-22 12:40:40 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2008-11-22 12:40:40 +0000
commite9a79dea44933b80e9080430e568ca8006acf64c (patch)
tree875ac01caf8da6976625323fab8fe79c27a6ff89
parentb2c7fc83d68ffb3d5fb9131373a5f30b1cbdd74d (diff)
Move diagnostic assertions concerning the recycle process of buffers
from getnewbuf() to buf_put(), since getnewbuf() does not directly recycle buffers anymore. While at it, remove two lines of dead code from getnewbuf(), which used to disassociate a vnode from a buffer. "just go for it, because everyone had a chance" deraadt@.
-rw-r--r--sys/kern/vfs_bio.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 29849bf5312..350b6fb8214 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_bio.c,v 1.107 2008/06/14 00:49:35 art Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.108 2008/11/22 12:40:39 pedro Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*-
@@ -261,23 +261,22 @@ void
buf_put(struct buf *bp)
{
splassert(IPL_BIO);
+
#ifdef DIAGNOSTIC
if (bp->b_pobj != NULL)
KASSERT(bp->b_bufsize > 0);
-#endif
-#ifdef DIAGNOSTIC
+ if (ISSET(bp->b_flags, B_DELWRI))
+ panic("buf_put: releasing dirty buffer");
if (bp->b_freelist.tqe_next != NOLIST &&
bp->b_freelist.tqe_next != (void *)-1)
panic("buf_put: still on the free list");
-
if (bp->b_vnbufs.le_next != NOLIST &&
bp->b_vnbufs.le_next != (void *)-1)
panic("buf_put: still on the vnode list");
-#endif
-#ifdef DIAGNOSTIC
if (!LIST_EMPTY(&bp->b_dep))
panic("buf_put: b_dep is not empty");
#endif
+
LIST_REMOVE(bp, b_list);
bcstats.numbufs--;
@@ -1018,23 +1017,8 @@ getsome:
bp->b_flags = 0;
buf_acquire(bp);
-#ifdef DIAGNOSTIC
- if (ISSET(bp->b_flags, B_DELWRI))
- panic("Dirty buffer on BQ_CLEAN");
-#endif
-
- /* disassociate us from our vnode, if we had one... */
- if (bp->b_vp)
- brelvp(bp);
-
splx(s);
-#ifdef DIAGNOSTIC
- /* CLEAN buffers must have no dependencies */
- if (LIST_FIRST(&bp->b_dep) != NULL)
- panic("BQ_CLEAN has buffer with dependencies");
-#endif
-
/* clear out various other fields */
bp->b_dev = NODEV;
bp->b_blkno = bp->b_lblkno = 0;