1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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) { if ((bp->b_flags & B_DELWRI) == 0) {
bp->b_flags |= B_DONE | B_DELWRI; bp->b_flags |= B_DONE | B_DELWRI;
reassignbuf(bp, bp->b_vp); reassignbuf(bp);
atomic_add_int(&numdirtybuffers, 1); atomic_add_int(&numdirtybuffers, 1);
bd_wakeup((lodirtybuffers + hidirtybuffers) / 2); bd_wakeup((lodirtybuffers + hidirtybuffers) / 2);
} }
@ -1136,7 +1136,7 @@ bundirty(bp)
if (bp->b_flags & B_DELWRI) { if (bp->b_flags & B_DELWRI) {
bp->b_flags &= ~B_DELWRI; bp->b_flags &= ~B_DELWRI;
reassignbuf(bp, bp->b_vp); reassignbuf(bp);
atomic_subtract_int(&numdirtybuffers, 1); atomic_subtract_int(&numdirtybuffers, 1);
numdirtywakeup(lodirtybuffers); numdirtywakeup(lodirtybuffers);
} }

View File

@ -969,7 +969,7 @@ cluster_wbuild(vp, size, start_lbn, len)
tbp->b_ioflags &= ~BIO_ERROR; tbp->b_ioflags &= ~BIO_ERROR;
tbp->b_flags |= B_ASYNC; tbp->b_flags |= B_ASYNC;
tbp->b_iocmd = BIO_WRITE; 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); VI_LOCK(tbp->b_vp);
++tbp->b_vp->v_numoutput; ++tbp->b_vp->v_numoutput;
VI_UNLOCK(tbp->b_vp); VI_UNLOCK(tbp->b_vp);

View File

@ -1794,17 +1794,11 @@ pbrelvp(bp)
* (indirect blocks) to the vnode to which they belong. * (indirect blocks) to the vnode to which they belong.
*/ */
void void
reassignbuf(bp, newvp) reassignbuf(struct buf *bp)
register struct buf *bp;
register struct vnode *newvp;
{ {
struct vnode *vp; struct vnode *vp;
int delay; int delay;
if (newvp == NULL) {
printf("reassignbuf: NULL");
return;
}
vp = bp->b_vp; vp = bp->b_vp;
++reassignbufcalls; ++reassignbufcalls;
@ -1819,24 +1813,15 @@ reassignbuf(bp, newvp)
* Delete from old vnode list, if on one. * Delete from old vnode list, if on one.
*/ */
VI_LOCK(vp); VI_LOCK(vp);
if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) { if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN))
buf_vlist_remove(bp); 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 * If dirty, put on list of dirty buffers; otherwise insert onto list
* of clean buffers. * of clean buffers.
*/ */
if (bp->b_flags & B_DELWRI) { if (bp->b_flags & B_DELWRI) {
if ((newvp->v_iflag & VI_ONWORKLST) == 0) { if ((vp->v_iflag & VI_ONWORKLST) == 0) {
switch (newvp->v_type) { switch (vp->v_type) {
case VDIR: case VDIR:
delay = dirdelay; delay = dirdelay;
break; break;
@ -1846,26 +1831,22 @@ reassignbuf(bp, newvp)
default: default:
delay = filedelay; 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 { } else {
buf_vlist_add(bp, newvp, BX_VNCLEAN); buf_vlist_add(bp, vp, BX_VNCLEAN);
if ((newvp->v_iflag & VI_ONWORKLST) && if ((vp->v_iflag & VI_ONWORKLST) &&
TAILQ_EMPTY(&newvp->v_dirtyblkhd)) { TAILQ_EMPTY(&vp->v_dirtyblkhd)) {
mtx_lock(&sync_mtx); mtx_lock(&sync_mtx);
LIST_REMOVE(newvp, v_synclist); LIST_REMOVE(vp, v_synclist);
syncer_worklist_len--; syncer_worklist_len--;
mtx_unlock(&sync_mtx); mtx_unlock(&sync_mtx);
newvp->v_iflag &= ~VI_ONWORKLST; vp->v_iflag &= ~VI_ONWORKLST;
} }
} }
if (bp->b_vp != newvp) { VI_UNLOCK(vp);
bp->b_vp = newvp;
vholdl(bp->b_vp);
}
VI_UNLOCK(newvp);
} }
/* /*

View File

@ -2989,7 +2989,7 @@ nfs4_writebp(struct buf *bp, int force, struct thread *td)
if (oldflags & B_DELWRI) { if (oldflags & B_DELWRI) {
s = splbio(); s = splbio();
reassignbuf(bp, bp->b_vp); reassignbuf(bp);
splx(s); splx(s);
} }

View File

@ -2980,7 +2980,7 @@ nfs_writebp(struct buf *bp, int force, struct thread *td)
if (oldflags & B_DELWRI) { if (oldflags & B_DELWRI) {
s = splbio(); s = splbio();
reassignbuf(bp, bp->b_vp); reassignbuf(bp);
splx(s); splx(s);
} }

View File

@ -521,7 +521,7 @@ void bgetvp(struct vnode *, struct buf *);
void pbgetvp(struct vnode *, struct buf *); void pbgetvp(struct vnode *, struct buf *);
void pbrelvp(struct buf *); void pbrelvp(struct buf *);
int allocbuf(struct buf *bp, int size); int allocbuf(struct buf *bp, int size);
void reassignbuf(struct buf *, struct vnode *); void reassignbuf(struct buf *);
struct buf *trypbuf(int *); struct buf *trypbuf(int *);
void bwait(struct buf *, u_char, const char *); void bwait(struct buf *, u_char, const char *);
void bdone(struct buf *); void bdone(struct buf *);