diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 1997-04-14 04:23:27 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 1997-04-14 04:23:27 +0000 |
commit | 2c76abf612bd4c5355ba78c76552e26e6a34c151 (patch) | |
tree | 246276520a1fdecde08aada79b9043a062a6d847 /sys/kern | |
parent | 3237113ee6497bdf81974f24d03b6e5d1eaf6d47 (diff) |
Minor performance enhancements from NetBSD
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_bio.c | 36 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 8 |
2 files changed, 37 insertions, 7 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 33ad1cad470..ffa423f0c88 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.13 1997/01/05 11:09:01 niklas Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.14 1997/04/14 04:23:23 tholo Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -602,6 +602,20 @@ brelse(bp) if (ISSET(bp->b_flags, (B_NOCACHE|B_ERROR))) SET(bp->b_flags, B_INVAL); + if (ISSET(bp->b_flags, B_VFLUSH)) { + /* + * This is a delayed write buffer that was just flushed to + * disk. It is still on the LRU queue. If it's become + * invalid, then we need to move it to a different queue; + * otherwise leave it in its current position. + */ + CLR(bp->b_flags, B_VFLUSH); + if (!ISSET(bp->b_flags, B_ERROR|B_INVAL|B_LOCKED|B_AGE)) + goto already_queued; + else + bremfree(bp); + } + if ((bp->b_bufsize <= 0) || ISSET(bp->b_flags, B_INVAL)) { /* * If it's invalid or empty, dissociate it from its vnode @@ -636,6 +650,7 @@ brelse(bp) binstailfree(bp, bufq); } +already_queued: /* Unlock the buffer. */ CLR(bp->b_flags, (B_AGE | B_ASYNC | B_BUSY | B_NOCACHE)); @@ -870,13 +885,30 @@ start: return (0); } + if (ISSET(bp->b_flags, B_VFLUSH)) { + /* + * This is a delayed write buffer being flushed to disk. Make + * sure it gets aged out of the queue when it's finished, and + * leave it off the LRU queue. + */ + CLR(bp->b_flags, B_VFLUSH); + SET(bp->b_flags, B_AGE); + splx(s); + goto start; + } + /* Buffer is no longer on free lists. */ SET(bp->b_flags, B_BUSY); /* If buffer was a delayed write, start it, and go back to the top. */ if (ISSET(bp->b_flags, B_DELWRI)) { splx(s); - bawrite (bp); + /* + * This buffer has gone through the LRU, so make sure it gets + * reused ASAP. + */ + SET(bp->b_flags, B_AGE); + bawrite(bp); goto start; } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 2c05c9f01f8..0d2ac94fbc1 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.8 1997/02/24 14:20:02 niklas Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.9 1997/04/14 04:23:26 tholo Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -467,8 +467,7 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) return (error); break; } - bremfree(bp); - bp->b_flags |= B_BUSY; + bp->b_flags |= B_BUSY | B_VFLUSH; splx(s); /* * XXX Since there are no node locks for NFS, I believe @@ -505,8 +504,7 @@ loop: continue; if ((bp->b_flags & B_DELWRI) == 0) panic("vflushbuf: not dirty"); - bremfree(bp); - bp->b_flags |= B_BUSY; + bp->b_flags |= B_BUSY | B_VFLUSH; splx(s); /* * Wait for I/O associated with indirect blocks to complete, |