diff options
author | phk <phk@FreeBSD.org> | 2004-10-22 08:47:20 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-10-22 08:47:20 +0000 |
commit | 52a089c5262ab46beaee3c8aaedbd0c47da5b403 (patch) | |
tree | bc42241b941aa567a6f2ea05e7900cd388eae620 /sys/nfsclient/nfs_vnops.c | |
parent | ec23a3b685c6fad6459a67f5c814bf8203a9c664 (diff) | |
download | FreeBSD-src-52a089c5262ab46beaee3c8aaedbd0c47da5b403.zip FreeBSD-src-52a089c5262ab46beaee3c8aaedbd0c47da5b403.tar.gz |
Add b_bufobj to struct buf which eventually will eliminate the need for b_vp.
Initialize b_bufobj for all buffers.
Make incore() and gbincore() take a bufobj instead of a vnode.
Make inmem() local to vfs_bio.c
Change a lot of VI_[UN]LOCK(bp->b_vp) to BO_[UN]LOCK(bp->b_bufobj)
also VI_MTX() to BO_MTX(),
Make buf_vlist_add() take a bufobj instead of a vnode.
Eliminate other uses of bp->b_vp where bp->b_bufobj will do.
Various minor polishing: remove "register", turn panic into KASSERT,
use new function declarations, TAILQ_FOREACH_SAFE() etc.
Diffstat (limited to 'sys/nfsclient/nfs_vnops.c')
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index efc2e61..d664573 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -2618,8 +2618,7 @@ again: */ bveccount = 0; VI_LOCK(vp); - for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { - nbp = TAILQ_NEXT(bp, b_bobufs); + TAILQ_FOREACH_SAFE(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs, nbp) { if (BUF_REFCNT(bp) == 0 && (bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) == (B_DELWRI | B_NEEDCOMMIT)) @@ -2650,7 +2649,7 @@ again: bvec = bvec_on_stack; bvecsize = NFS_COMMITBVECSIZ; } - for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { + TAILQ_FOREACH_SAFE(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs, nbp) { if (bvecpos >= bvecsize) break; if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) { @@ -2778,8 +2777,7 @@ again: loop: s = splbio(); VI_LOCK(vp); - for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { - nbp = TAILQ_NEXT(bp, b_bobufs); + TAILQ_FOREACH_SAFE(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs, nbp) { if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) { if (waitfor != MNT_WAIT || passone) continue; @@ -2838,7 +2836,7 @@ loop: VI_LOCK(vp); } } - if (!TAILQ_EMPTY(&vp->v_dirtyblkhd) && commit) { + if (vp->v_bufobj.bo_dirty.bv_cnt != 0 && commit) { VI_UNLOCK(vp); goto loop; } @@ -2920,7 +2918,7 @@ nfs_writebp(struct buf *bp, int force __unused, struct thread *td) bp->b_ioflags &= ~BIO_ERROR; bp->b_iocmd = BIO_WRITE; - bufobj_wref(&bp->b_vp->v_bufobj); + bufobj_wref(bp->b_bufobj); curthread->td_proc->p_stats->p_ru.ru_oublock++; splx(s); |