Eliminate unused second argument to reassignbuf() and simplify it

accordingly.
This commit is contained in:
Poul-Henning Kamp 2004-07-25 21:24:23 +00:00
parent 3ed994c6c3
commit cf95b5c381
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132640
6 changed files with 18 additions and 37 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}
/*

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 *);