diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-02-23 14:52:53 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-02-23 14:52:53 +0000 |
commit | eeec1f347171a41707419e89deee7d71381aea55 (patch) | |
tree | 2a1bc87074ca0044ac111b494ffc6eb467896e11 /sys/nfs | |
parent | 96e821437735f981862bb50be47e2c291a615907 (diff) |
Change the B_DELWRI flag using buf_dirty and buf_undirty instead of
manually twiddling it. This allows the buffer cache to more easily
keep track of dirty buffers and decide when it is appropriate to speed
up the syncer.
Insipired by FreeBSD.
Look over by art@
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_bio.c | 22 | ||||
-rw-r--r-- | sys/nfs/nfs_syscalls.c | 6 | ||||
-rw-r--r-- | sys/nfs/nfs_vnops.c | 26 |
3 files changed, 19 insertions, 35 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index a7c8598f465..950fe138235 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_bio.c,v 1.17 2001/02/23 14:42:38 csapuntz Exp $ */ +/* $OpenBSD: nfs_bio.c,v 1.18 2001/02/23 14:52:50 csapuntz Exp $ */ /* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */ /* @@ -746,10 +746,8 @@ nfs_asyncio(bp, cred) * is currently doing a write for this file and will pick up the * delayed writes before going back to sleep. */ - bp->b_flags |= B_DELWRI; - s = splbio(); - reassignbuf(bp, bp->b_vp); + buf_dirty(bp); splx(s); biodone(bp); return (0); @@ -909,20 +907,12 @@ nfs_doio(bp, cr, p) * B_DELWRI and B_NEEDCOMMIT flags. */ if (error == EINTR || (!error && (bp->b_flags & B_NEEDCOMMIT))) { - bp->b_flags |= B_DELWRI; - - /* - * Since for the B_ASYNC case, nfs_bwrite() has reassigned the - * buffer to the clean list, we have to reassign it back to the - * dirty one. Ugh. - */ - if (bp->b_flags & B_ASYNC) { s = splbio(); - reassignbuf(bp, vp); + buf_dirty(bp); splx(s); - } - else if (error) - bp->b_flags |= B_EINTR; + + if (!(bp->b_flags & B_ASYNC) && error) + bp->b_flags |= B_EINTR; } else { if (error) { bp->b_flags |= B_ERROR; diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 74769e1d1f0..6463d1ce197 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.16 2000/11/09 17:23:38 art Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.17 2001/02/23 14:52:51 csapuntz Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -906,8 +906,8 @@ nfssvc_iod(p) * up to, but not including nfs_strategy(). */ if (nbp) { - nbp->b_flags &= ~(B_READ|B_DONE|B_ERROR|B_DELWRI); - reassignbuf(nbp, nbp->b_vp); + nbp->b_flags &= ~(B_READ|B_DONE|B_ERROR); + buf_undirty(bp); nbp->b_vp->v_numoutput++; } splx(s); diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index 87dc935fc5c..a49bb3c8fbe 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vnops.c,v 1.27 2001/02/09 22:26:05 mickey Exp $ */ +/* $OpenBSD: nfs_vnops.c,v 1.28 2001/02/23 14:52:51 csapuntz Exp $ */ /* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */ /* @@ -2762,11 +2762,11 @@ again: brelse(bp); else { s = splbio(); + buf_undirty(bp); vp->v_numoutput++; bp->b_flags |= B_ASYNC; - bp->b_flags &= ~(B_READ|B_DONE|B_ERROR|B_DELWRI); + bp->b_flags &= ~(B_READ|B_DONE|B_ERROR); bp->b_dirtyoff = bp->b_dirtyend = 0; - reassignbuf(bp, vp); splx(s); biodone(bp); } @@ -3049,16 +3049,14 @@ nfs_writebp(bp, force) bp, bp->b_vp, bp->b_validoff, bp->b_validend, bp->b_dirtyoff, bp->b_dirtyend); #endif - bp->b_flags &= ~(B_READ|B_DONE|B_ERROR|B_DELWRI); + bp->b_flags &= ~(B_READ|B_DONE|B_ERROR); s = splbio(); - if (oldflags & B_ASYNC) { - if (oldflags & B_DELWRI) { - reassignbuf(bp, bp->b_vp); - } else if (p) { - ++p->p_stats->p_ru.ru_oublock; - } - } + buf_undirty(bp); + + if ((oldflags & B_ASYNC) && !(oldflags & B_DELWRI) && p) + ++p->p_stats->p_ru.ru_oublock; + bp->b_vp->v_numoutput++; splx(s); @@ -3088,11 +3086,7 @@ nfs_writebp(bp, force) if( (oldflags & B_ASYNC) == 0) { int rtval = biowait(bp); - if (oldflags & B_DELWRI) { - s = splbio(); - reassignbuf(bp, bp->b_vp); - splx(s); - } else if (p) { + if (!(oldflags & B_DELWRI) && p) { ++p->p_stats->p_ru.ru_oublock; } brelse(bp); |