diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2008-06-14 19:33:59 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2008-06-14 19:33:59 +0000 |
commit | 259b3b66530b4add28b09b106f2f076bcdcde4c6 (patch) | |
tree | e17d7ac1216a2ff9312dda8e46eb90b0838db1ea /sys/nfs/nfs_bio.c | |
parent | e24a5f78bf2d12757be73a5293bc0d73ef7634e7 (diff) |
Ensure each nfsiod can actually enqueue more than one asynchio - this mirrors
the accidental situation that used to happen when it leaked buffers and allowed
the syncer to do it, however this puts a limit on how much of the buffer cache
it is allowed to consume to a sensible amount - improves nfs write performance
since we don't have to do tons of them synch now.
Modifies the existing code to use wakeup_one instead of cruft, and now
all nfsiod's tsleep the same way.
ok thib@ art@
Diffstat (limited to 'sys/nfs/nfs_bio.c')
-rw-r--r-- | sys/nfs/nfs_bio.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index e71beddf1a8..929152321e0 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_bio.c,v 1.50 2008/06/12 19:14:15 thib Exp $ */ +/* $OpenBSD: nfs_bio.c,v 1.51 2008/06/14 19:33:58 beck Exp $ */ /* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */ /* @@ -60,6 +60,7 @@ extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON]; extern int nfs_numasync; extern struct nfsstats nfsstats; struct nfs_bufqhead nfs_bufq; +uint32_t nfs_bufqmax, nfs_bufqlen; /* * Vnode op for read using bio @@ -545,24 +546,22 @@ int nfs_asyncio(bp) struct buf *bp; { - int i; - if (nfs_numasync == 0) goto out; - for (i = 0; i < NFS_MAXASYNCDAEMON; i++) { - if (nfs_iodwant[i]) { - if ((bp->b_flags & B_READ) == 0) { - bp->b_flags |= B_WRITEINPROG; - } - - TAILQ_INSERT_TAIL(&nfs_bufq, bp, b_freelist); - nfs_iodwant[i] = (struct proc *)0; - wakeup((caddr_t)&nfs_iodwant[i]); - return (0); - } + if (nfs_bufqlen > nfs_bufqmax) + goto out; /* too many bufs in use, force sync */ + + if ((bp->b_flags & B_READ) == 0) { + bp->b_flags |= B_WRITEINPROG; } + TAILQ_INSERT_TAIL(&nfs_bufq, bp, b_freelist); + nfs_bufqlen++; + + wakeup_one(&nfs_bufq); + return (0); + out: nfsstats.forcedsync++; return (EIO); |