diff options
author | phk <phk@FreeBSD.org> | 2004-10-21 15:53:54 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-10-21 15:53:54 +0000 |
commit | 3833976d1250bf118a46939f409012d87e558de6 (patch) | |
tree | 9d355bca75100170618443d740a1312fd842af5d /sys/nfs4client | |
parent | fdf614c0bad1564664cac5105be08477d1bcdd72 (diff) | |
download | FreeBSD-src-3833976d1250bf118a46939f409012d87e558de6.zip FreeBSD-src-3833976d1250bf118a46939f409012d87e558de6.tar.gz |
Move the VI_BWAIT flag into no bo_flag element of bufobj and call it BO_WWAIT
Add bufobj_wref(), bufobj_wdrop() and bufobj_wwait() to handle the write
count on a bufobj. Bufobj_wdrop() replaces vwakeup().
Use these functions all relevant places except in ffs_softdep.c where
the use if interlocked_sleep() makes this impossible.
Rename b_vnbufs to b_bobufs now that we touch all the relevant files anyway.
Diffstat (limited to 'sys/nfs4client')
-rw-r--r-- | sys/nfs4client/nfs4_vnops.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/nfs4client/nfs4_vnops.c b/sys/nfs4client/nfs4_vnops.c index 937db83..33dde9d 100644 --- a/sys/nfs4client/nfs4_vnops.c +++ b/sys/nfs4client/nfs4_vnops.c @@ -2642,7 +2642,7 @@ again: bveccount = 0; VI_LOCK(vp); for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { - nbp = TAILQ_NEXT(bp, b_vnbufs); + nbp = TAILQ_NEXT(bp, b_bobufs); if (BUF_REFCNT(bp) == 0 && (bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) == (B_DELWRI | B_NEEDCOMMIT)) @@ -2677,13 +2677,13 @@ again: if (bvecpos >= bvecsize) break; if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) { - nbp = TAILQ_NEXT(bp, b_vnbufs); + nbp = TAILQ_NEXT(bp, b_bobufs); continue; } if ((bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) != (B_DELWRI | B_NEEDCOMMIT)) { BUF_UNLOCK(bp); - nbp = TAILQ_NEXT(bp, b_vnbufs); + nbp = TAILQ_NEXT(bp, b_bobufs); continue; } VI_UNLOCK(vp); @@ -2711,7 +2711,7 @@ again: * and vfs_busy_pages() may sleep. We have to * recalculate nbp. */ - nbp = TAILQ_NEXT(bp, b_vnbufs); + nbp = TAILQ_NEXT(bp, b_bobufs); /* * A list of these buffers is kept so that the @@ -2783,9 +2783,7 @@ again: * into bundirty(). XXX */ s = splbio(); - VI_LOCK(vp); - vp->v_numoutput++; - VI_UNLOCK(vp); + bufobj_wref(&vp->v_bufobj); bp->b_flags |= B_ASYNC; bundirty(bp); bp->b_flags &= ~B_DONE; @@ -2804,7 +2802,7 @@ loop: s = splbio(); VI_LOCK(vp); for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { - nbp = TAILQ_NEXT(bp, b_vnbufs); + nbp = TAILQ_NEXT(bp, b_bobufs); if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) { if (waitfor != MNT_WAIT || passone) continue; @@ -2850,10 +2848,8 @@ loop: goto again; } if (waitfor == MNT_WAIT) { - while (vp->v_numoutput) { - vp->v_iflag |= VI_BWAIT; - error = msleep((caddr_t)&vp->v_numoutput, VI_MTX(vp), - slpflag | (PRIBIO + 1), "nfsfsync", slptimeo); + while (vp->v_bufobj.bo_numoutput) { + error = bufobj_wwait(&vp->v_bufobj, slpflag, slptimeo); if (error) { VI_UNLOCK(vp); if (nfs4_sigintr(nmp, NULL, td)) { @@ -2950,9 +2946,7 @@ nfs4_writebp(struct buf *bp, int force __unused, struct thread *td) bp->b_ioflags &= ~BIO_ERROR; bp->b_iocmd = BIO_WRITE; - VI_LOCK(bp->b_vp); - bp->b_vp->v_numoutput++; - VI_UNLOCK(bp->b_vp); + bufobj_wref(&bp->b_vp->v_bufobj); curthread->td_proc->p_stats->p_ru.ru_oublock++; splx(s); |