From cf95b5c38182a9a9721a81d574f850f33ff31eb8 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 25 Jul 2004 21:24:23 +0000 Subject: [PATCH] Eliminate unused second argument to reassignbuf() and simplify it accordingly. --- sys/kern/vfs_bio.c | 4 ++-- sys/kern/vfs_cluster.c | 2 +- sys/kern/vfs_subr.c | 43 +++++++++++-------------------------- sys/nfs4client/nfs4_vnops.c | 2 +- sys/nfsclient/nfs_vnops.c | 2 +- sys/sys/buf.h | 2 +- 6 files changed, 18 insertions(+), 37 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index e8ff1b1fa310..7acabb315a2d 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1109,7 +1109,7 @@ bdirty(bp) if ((bp->b_flags & B_DELWRI) == 0) { bp->b_flags |= B_DONE | B_DELWRI; - reassignbuf(bp, bp->b_vp); + reassignbuf(bp); atomic_add_int(&numdirtybuffers, 1); bd_wakeup((lodirtybuffers + hidirtybuffers) / 2); } @@ -1136,7 +1136,7 @@ bundirty(bp) if (bp->b_flags & B_DELWRI) { bp->b_flags &= ~B_DELWRI; - reassignbuf(bp, bp->b_vp); + reassignbuf(bp); atomic_subtract_int(&numdirtybuffers, 1); numdirtywakeup(lodirtybuffers); } diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index c51598b0a385..453831fe0a4f 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -969,7 +969,7 @@ cluster_wbuild(vp, size, start_lbn, len) tbp->b_ioflags &= ~BIO_ERROR; tbp->b_flags |= B_ASYNC; tbp->b_iocmd = BIO_WRITE; - reassignbuf(tbp, tbp->b_vp); /* put on clean list */ + reassignbuf(tbp); /* put on clean list */ VI_LOCK(tbp->b_vp); ++tbp->b_vp->v_numoutput; VI_UNLOCK(tbp->b_vp); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index e483b436a0d8..ca5ee2f17fa2 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1794,17 +1794,11 @@ pbrelvp(bp) * (indirect blocks) to the vnode to which they belong. */ void -reassignbuf(bp, newvp) - register struct buf *bp; - register struct vnode *newvp; +reassignbuf(struct buf *bp) { struct vnode *vp; int delay; - if (newvp == NULL) { - printf("reassignbuf: NULL"); - return; - } vp = bp->b_vp; ++reassignbufcalls; @@ -1819,24 +1813,15 @@ reassignbuf(bp, newvp) * Delete from old vnode list, if on one. */ VI_LOCK(vp); - if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) { + if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) buf_vlist_remove(bp); - if (vp != newvp) { - vdropl(bp->b_vp); - bp->b_vp = NULL; /* for clarification */ - } - } - if (vp != newvp) { - VI_UNLOCK(vp); - VI_LOCK(newvp); - } /* * If dirty, put on list of dirty buffers; otherwise insert onto list * of clean buffers. */ if (bp->b_flags & B_DELWRI) { - if ((newvp->v_iflag & VI_ONWORKLST) == 0) { - switch (newvp->v_type) { + if ((vp->v_iflag & VI_ONWORKLST) == 0) { + switch (vp->v_type) { case VDIR: delay = dirdelay; break; @@ -1846,26 +1831,22 @@ reassignbuf(bp, newvp) default: delay = filedelay; } - vn_syncer_add_to_worklist(newvp, delay); + vn_syncer_add_to_worklist(vp, delay); } - buf_vlist_add(bp, newvp, BX_VNDIRTY); + buf_vlist_add(bp, vp, BX_VNDIRTY); } else { - buf_vlist_add(bp, newvp, BX_VNCLEAN); + buf_vlist_add(bp, vp, BX_VNCLEAN); - if ((newvp->v_iflag & VI_ONWORKLST) && - TAILQ_EMPTY(&newvp->v_dirtyblkhd)) { + if ((vp->v_iflag & VI_ONWORKLST) && + TAILQ_EMPTY(&vp->v_dirtyblkhd)) { mtx_lock(&sync_mtx); - LIST_REMOVE(newvp, v_synclist); + LIST_REMOVE(vp, v_synclist); syncer_worklist_len--; mtx_unlock(&sync_mtx); - newvp->v_iflag &= ~VI_ONWORKLST; + vp->v_iflag &= ~VI_ONWORKLST; } } - if (bp->b_vp != newvp) { - bp->b_vp = newvp; - vholdl(bp->b_vp); - } - VI_UNLOCK(newvp); + VI_UNLOCK(vp); } /* diff --git a/sys/nfs4client/nfs4_vnops.c b/sys/nfs4client/nfs4_vnops.c index 27464a98db62..1acb9155866b 100644 --- a/sys/nfs4client/nfs4_vnops.c +++ b/sys/nfs4client/nfs4_vnops.c @@ -2989,7 +2989,7 @@ nfs4_writebp(struct buf *bp, int force, struct thread *td) if (oldflags & B_DELWRI) { s = splbio(); - reassignbuf(bp, bp->b_vp); + reassignbuf(bp); splx(s); } diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index adc2219bd5d1..663e3b00070a 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -2980,7 +2980,7 @@ nfs_writebp(struct buf *bp, int force, struct thread *td) if (oldflags & B_DELWRI) { s = splbio(); - reassignbuf(bp, bp->b_vp); + reassignbuf(bp); splx(s); } diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 30235bee1975..4aa5e4fe781d 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -521,7 +521,7 @@ void bgetvp(struct vnode *, struct buf *); void pbgetvp(struct vnode *, struct buf *); void pbrelvp(struct buf *); int allocbuf(struct buf *bp, int size); -void reassignbuf(struct buf *, struct vnode *); +void reassignbuf(struct buf *); struct buf *trypbuf(int *); void bwait(struct buf *, u_char, const char *); void bdone(struct buf *);