summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_bio.c19
-rw-r--r--sys/kern/vfs_subr.c12
-rw-r--r--sys/sys/buf.h7
-rw-r--r--sys/sys/vnode.h6
4 files changed, 20 insertions, 24 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 7e311877cc1..b5f0cd0f02a 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_bio.c,v 1.177 2016/09/15 02:00:16 dlg Exp $ */
+/* $OpenBSD: vfs_bio.c,v 1.178 2016/09/16 02:54:51 dlg Exp $ */
/* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */
/*
@@ -247,8 +247,7 @@ bufadjust(int newbufpages)
(bcstats.numbufpages > targetpages)) {
bufcache_take(bp);
if (bp->b_vp) {
- RB_REMOVE(buf_rb_bufs,
- &bp->b_vp->v_bufs_tree, bp);
+ RBT_REMOVE(buf_rb_bufs, &bp->b_vp->v_bufs_tree, bp);
brelvp(bp);
}
buf_put(bp);
@@ -758,8 +757,7 @@ brelse(struct buf *bp)
}
if (bp->b_vp) {
- RB_REMOVE(buf_rb_bufs, &bp->b_vp->v_bufs_tree,
- bp);
+ RBT_REMOVE(buf_rb_bufs, &bp->b_vp->v_bufs_tree, bp);
brelvp(bp);
}
bp->b_vp = NULL;
@@ -826,7 +824,7 @@ incore(struct vnode *vp, daddr_t blkno)
/* Search buf lookup tree */
b.b_lblkno = blkno;
- bp = RB_FIND(buf_rb_bufs, &vp->v_bufs_tree, &b);
+ bp = RBT_FIND(buf_rb_bufs, &vp->v_bufs_tree, &b);
if (bp != NULL && ISSET(bp->b_flags, B_INVAL))
bp = NULL;
@@ -862,7 +860,7 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int slpflag, int slptimeo)
start:
s = splbio();
b.b_lblkno = blkno;
- bp = RB_FIND(buf_rb_bufs, &vp->v_bufs_tree, &b);
+ bp = RBT_FIND(buf_rb_bufs, &vp->v_bufs_tree, &b);
if (bp != NULL) {
if (ISSET(bp->b_flags, B_BUSY)) {
SET(bp->b_flags, B_WANTED);
@@ -945,7 +943,7 @@ buf_get(struct vnode *vp, daddr_t blkno, size_t size)
(bp = bufcache_getanycleanbuf())) {
bufcache_take(bp);
if (bp->b_vp) {
- RB_REMOVE(buf_rb_bufs,
+ RBT_REMOVE(buf_rb_bufs,
&bp->b_vp->v_bufs_tree, bp);
brelvp(bp);
}
@@ -1006,7 +1004,7 @@ buf_get(struct vnode *vp, daddr_t blkno, size_t size)
bp->b_blkno = bp->b_lblkno = blkno;
bgetvp(vp, bp);
- if (RB_INSERT(buf_rb_bufs, &vp->v_bufs_tree, bp))
+ if (RBT_INSERT(buf_rb_bufs, &vp->v_bufs_tree, bp))
panic("buf_get: dup lblk vp %p bp %p", vp, bp);
} else {
bp->b_vnbufs.le_next = NOLIST;
@@ -1505,8 +1503,7 @@ hibernate_suspend_bufcache(void)
while ((bp = bufcache_getcleanbuf_range(DMA_CACHE, NUM_CACHES - 1, 1))) {
bufcache_take(bp);
if (bp->b_vp) {
- RB_REMOVE(buf_rb_bufs,
- &bp->b_vp->v_bufs_tree, bp);
+ RBT_REMOVE(buf_rb_bufs, &bp->b_vp->v_bufs_tree, bp);
brelvp(bp);
}
buf_put(bp);
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 2bdb9abed61..dc80da9ef95 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.251 2016/09/15 02:00:16 dlg Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.252 2016/09/16 02:54:51 dlg Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -122,11 +122,11 @@ void printlockedvnodes(void);
struct pool vnode_pool;
struct pool uvm_vnode_pool;
-static int rb_buf_compare(struct buf *b1, struct buf *b2);
-RB_GENERATE(buf_rb_bufs, buf, b_rbbufs, rb_buf_compare);
+static inline int rb_buf_compare(const struct buf *b1, const struct buf *b2);
+RBT_GENERATE(buf_rb_bufs, buf, b_rbbufs, rb_buf_compare);
-static int
-rb_buf_compare(struct buf *b1, struct buf *b2)
+static inline int
+rb_buf_compare(const struct buf *b1, const struct buf *b2)
{
if (b1->b_lblkno < b2->b_lblkno)
return(-1);
@@ -375,7 +375,7 @@ getnewvnode(enum vtagtype tag, struct mount *mp, struct vops *vops,
vp = pool_get(&vnode_pool, PR_WAITOK | PR_ZERO);
vp->v_uvm = pool_get(&uvm_vnode_pool, PR_WAITOK | PR_ZERO);
vp->v_uvm->u_vnode = vp;
- RB_INIT(&vp->v_bufs_tree);
+ RBT_INIT(buf_rb_bufs, &vp->v_bufs_tree);
RB_INIT(&vp->v_nc_tree);
TAILQ_INIT(&vp->v_cache_dst);
numvnodes++;
diff --git a/sys/sys/buf.h b/sys/sys/buf.h
index f80cefeb8b9..0ee95e43e6d 100644
--- a/sys/sys/buf.h
+++ b/sys/sys/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.103 2016/05/23 09:31:28 natano Exp $ */
+/* $OpenBSD: buf.h,v 1.104 2016/09/16 02:54:51 dlg Exp $ */
/* $NetBSD: buf.h,v 1.25 1997/04/09 21:12:17 mycroft Exp $ */
/*
@@ -48,9 +48,6 @@
struct buf;
struct vnode;
-struct buf_rb_bufs;
-RB_PROTOTYPE(buf_rb_bufs, buf, b_rbbufs, rb_buf_compare);
-
LIST_HEAD(bufhead, buf);
/*
@@ -140,7 +137,7 @@ extern struct bio_ops {
/* The buffer header describes an I/O operation in the kernel. */
struct buf {
- RB_ENTRY(buf) b_rbbufs; /* vnode "hash" tree */
+ RBT_ENTRY(buf) b_rbbufs; /* vnode "hash" tree */
LIST_ENTRY(buf) b_list; /* All allocated buffers. */
LIST_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h
index a94e6e9fa30..477a70e0d42 100644
--- a/sys/sys/vnode.h
+++ b/sys/sys/vnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnode.h,v 1.135 2016/05/23 09:31:28 natano Exp $ */
+/* $OpenBSD: vnode.h,v 1.136 2016/09/16 02:54:51 dlg Exp $ */
/* $NetBSD: vnode.h,v 1.38 1996/02/29 20:59:05 cgd Exp $ */
/*
@@ -80,7 +80,9 @@ enum vtagtype {
*/
LIST_HEAD(buflists, buf);
-RB_HEAD(buf_rb_bufs, buf);
+RBT_HEAD(buf_rb_bufs, buf);
+RBT_PROTOTYPE(buf_rb_bufs, buf, b_rbbufs, rb_buf_compare);
+
RB_HEAD(namecache_rb_cache, namecache);
struct uvm_vnode;