-/* $OpenBSD: vfs_bio.c,v 1.124 2010/07/01 16:23:09 thib Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.125 2010/08/03 04:10:16 matthew Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*
{
struct buf *bp;
struct buf b;
+ int s;
+
+ s = splbio();
/* Search buf lookup tree */
b.b_lblkno = blkno;
bp = RB_FIND(buf_rb_bufs, &vp->v_bufs_tree, &b);
- if (bp && !ISSET(bp->b_flags, B_INVAL))
- return(bp);
+ if (bp != NULL && ISSET(bp->b_flags, B_INVAL))
+ bp = NULL;
+
+ splx(s);
return(NULL);
}
* the block until the write is finished.
*/
start:
+ s = splbio();
b.b_lblkno = blkno;
bp = RB_FIND(buf_rb_bufs, &vp->v_bufs_tree, &b);
if (bp != NULL) {
-
- s = splbio();
if (ISSET(bp->b_flags, B_BUSY)) {
SET(bp->b_flags, B_WANTED);
error = tsleep(bp, slpflag | (PRIBIO + 1), "getblk",
splx(s);
return (bp);
}
- splx(s);
}
+ splx(s);
if ((bp = buf_get(vp, blkno, size)) == NULL)
goto start;