+ HOLDRELE(vp);
+}
+
+/*
+ * Reassign a buffer from one vnode to another.
+ * Used to assign file specific control information
+ * (indirect blocks) to the vnode to which they belong.
+ */
+reassignbuf(bp, newvp)
+ register struct buf *bp;
+ register struct vnode *newvp;
+{
+ register struct buf *bq, **listheadp;
+
+ if (newvp == NULL)
+ panic("reassignbuf: NULL");
+ /*
+ * Delete from old vnode list, if on one.
+ */
+ if (bp->b_blockb) {
+ if (bq = bp->b_blockf)
+ bq->b_blockb = bp->b_blockb;
+ *bp->b_blockb = bq;
+ }
+ /*
+ * If dirty, put on list of dirty buffers;
+ * otherwise insert onto list of clean buffers.
+ */
+ if (bp->b_flags & B_DELWRI)
+ listheadp = &newvp->v_dirtyblkhd;
+ else
+ listheadp = &newvp->v_cleanblkhd;
+ if (*listheadp) {
+ bp->b_blockf = *listheadp;
+ bp->b_blockb = listheadp;
+ bp->b_blockf->b_blockb = &bp->b_blockf;
+ *listheadp = bp;
+ } else {
+ *listheadp = bp;
+ bp->b_blockb = listheadp;
+ bp->b_blockf = NULL;
+ }