summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-10-21 13:48:50 +0000
committerphk <phk@FreeBSD.org>2004-10-21 13:48:50 +0000
commit350f8121036f9f84eb11edc8cf3bd5435ffd9b6b (patch)
treed2232ef9893c2a5d6130356c2521a24f885d50fb /sys
parent32ca29f274ff564af89368ddb98c3bba7269b8e7 (diff)
downloadFreeBSD-src-350f8121036f9f84eb11edc8cf3bd5435ffd9b6b.zip
FreeBSD-src-350f8121036f9f84eb11edc8cf3bd5435ffd9b6b.tar.gz
Simplify buf_vlist_remove().
Now that we have encapsulated the splaytree related information into a structure we can eliminate the half of this function.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_subr.c50
1 files changed, 16 insertions, 34 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 44975d7..40b67b7 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1287,44 +1287,26 @@ buf_vlist_remove(struct buf *bp)
{
struct vnode *vp = bp->b_vp;
struct buf *root;
+ struct bufv *bv;
ASSERT_VI_LOCKED(vp, "buf_vlist_remove");
- if (bp->b_xflags & BX_VNDIRTY) {
- if (bp != vp->v_dirtyblkroot) {
- root = buf_splay(bp->b_lblkno, bp->b_xflags,
- vp->v_dirtyblkroot);
- KASSERT(root == bp,
- ("splay lookup failed during dirty remove"));
- }
- if (bp->b_left == NULL) {
- root = bp->b_right;
- } else {
- root = buf_splay(bp->b_lblkno, bp->b_xflags,
- bp->b_left);
- root->b_right = bp->b_right;
- }
- vp->v_dirtyblkroot = root;
- TAILQ_REMOVE(&vp->v_dirtyblkhd, bp, b_vnbufs);
- vp->v_dirtybufcnt--;
+ if (bp->b_xflags & BX_VNDIRTY)
+ bv = &vp->v_bufobj.bo_dirty;
+ else
+ bv = &vp->v_bufobj.bo_clean;
+ if (bp != bv->bv_root) {
+ root = buf_splay(bp->b_lblkno, bp->b_xflags, bv->bv_root);
+ KASSERT(root == bp, ("splay lookup failed in remove"));
+ }
+ if (bp->b_left == NULL) {
+ root = bp->b_right;
} else {
- /* KASSERT(bp->b_xflags & BX_VNCLEAN, ("bp wasn't clean")); */
- if (bp != vp->v_cleanblkroot) {
- root = buf_splay(bp->b_lblkno, bp->b_xflags,
- vp->v_cleanblkroot);
- KASSERT(root == bp,
- ("splay lookup failed during clean remove"));
- }
- if (bp->b_left == NULL) {
- root = bp->b_right;
- } else {
- root = buf_splay(bp->b_lblkno, bp->b_xflags,
- bp->b_left);
- root->b_right = bp->b_right;
- }
- vp->v_cleanblkroot = root;
- TAILQ_REMOVE(&vp->v_cleanblkhd, bp, b_vnbufs);
- vp->v_cleanbufcnt--;
+ root = buf_splay(bp->b_lblkno, bp->b_xflags, bp->b_left);
+ root->b_right = bp->b_right;
}
+ bv->bv_root = root;
+ TAILQ_REMOVE(&bv->bv_hd, bp, b_vnbufs);
+ bv->bv_cnt--;
bp->b_xflags &= ~(BX_VNDIRTY | BX_VNCLEAN);
}
OpenPOWER on IntegriCloud