diff options
author | peter <peter@FreeBSD.org> | 2002-01-14 02:13:46 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-01-14 02:13:46 +0000 |
commit | 08d32da0a5c6bdbe31475c3af6a0a86d09560d03 (patch) | |
tree | 077cb662afe0f3570e4fd98b2cbdc9d58d25867c /sys/nfsclient/nfs_bio.c | |
parent | 840adbd42c7eb9a9b6dad38f6479fc9781336d44 (diff) | |
download | FreeBSD-src-08d32da0a5c6bdbe31475c3af6a0a86d09560d03.zip FreeBSD-src-08d32da0a5c6bdbe31475c3af6a0a86d09560d03.tar.gz |
Implement vfs.nfs.iodmin (minimum number of nfsiod's) and
vfs.nfs.iodmaxidle (idle time before nfsiod's exit). Make it adaptive
so that we create nfsiod's on demand and they go away after not being
used for a while. The upper limit is NFS_MAXASYNCDAEMON (currently 20).
More will be done here, but this is a useful checkpoint.
Submitted by: Maxime Henrion <mux@qualys.com>
Diffstat (limited to 'sys/nfsclient/nfs_bio.c')
-rw-r--r-- | sys/nfsclient/nfs_bio.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 2f3a44b..3905118 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -424,7 +424,7 @@ nfs_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) /* * Start the read ahead(s), as required. */ - if (nfs_numasync > 0 && nmp->nm_readahead > 0) { + if (nmp->nm_readahead > 0) { for (nra = 0; nra < nmp->nm_readahead && nra < seqcount && (off_t)(lbn + 1 + nra) * biosize < np->n_size; nra++) { rabn = lbn + 1 + nra; @@ -609,7 +609,7 @@ again: * (You need the current block first, so that you have the * directory offset cookie of the next block.) */ - if (nfs_numasync > 0 && nmp->nm_readahead > 0 && + if (nmp->nm_readahead > 0 && (bp->b_flags & B_INVAL) == 0 && (np->n_direofoffset == 0 || (lbn + 1) * NFS_DIRBLKSIZ < np->n_direofoffset) && @@ -1117,19 +1117,12 @@ int nfs_asyncio(struct buf *bp, struct ucred *cred, struct thread *td) { struct nfsmount *nmp; - int i; + int iod; int gotiod; int slpflag = 0; int slptimeo = 0; int error; - /* - * If no async daemons then return EIO to force caller to run the rpc - * synchronously. - */ - if (nfs_numasync == 0) - return (EIO); - nmp = VFSTONFS(bp->b_vp->v_mount); /* @@ -1150,24 +1143,22 @@ again: /* * Find a free iod to process this request. */ - for (i = 0; i < NFS_MAXASYNCDAEMON; i++) - if (nfs_iodwant[i]) { - /* - * Found one, so wake it up and tell it which - * mount to process. - */ - NFS_DPF(ASYNCIO, - ("nfs_asyncio: waking iod %d for mount %p\n", - i, nmp)); - nfs_iodwant[i] = (struct proc *)0; - nfs_iodmount[i] = nmp; - nmp->nm_bufqiods++; - wakeup((caddr_t)&nfs_iodwant[i]); + for (iod = 0; iod < NFS_MAXASYNCDAEMON; iod++) + if (nfs_iodwant[iod]) { gotiod = TRUE; break; } /* + * Try to create one if none are free. + */ + if (!gotiod) { + iod = nfs_nfsiodnew(); + if (iod != -1) + gotiod = TRUE; + } + + /* * If none are free, we may already have an iod working on this mount * point. If so, it will process our request. */ @@ -1186,6 +1177,17 @@ again: */ if (gotiod) { /* + * Found one, so wake it up and tell it which + * mount to process. + */ + NFS_DPF(ASYNCIO, ("nfs_asyncio: waking iod %d for mount %p\n", + iod, nmp)); + nfs_iodwant[iod] = (struct proc *)0; + nfs_iodmount[iod] = nmp; + nmp->nm_bufqiods++; + wakeup((caddr_t)&nfs_iodwant[iod]); + + /* * Ensure that the queue never grows too large. We still want * to asynchronize so we block rather then return EIO. */ |