Exemplo n.º 1
0
static int
sysctl_iodmin(SYSCTL_HANDLER_ARGS)
{
	int error, i;
	int newmin;

	newmin = nfs_iodmin;
	error = sysctl_handle_int(oidp, &newmin, 0, req);
	if (error || (req->newptr == NULL))
		return (error);
	mtx_lock(&nfs_iod_mtx);
	if (newmin > nfs_iodmax) {
		error = EINVAL;
		goto out;
	}
	nfs_iodmin = newmin;
	if (nfs_numasync >= nfs_iodmin)
		goto out;
	/*
	 * If the current number of nfsiod is lower
	 * than the new minimum, create some more.
	 */
	for (i = nfs_iodmin - nfs_numasync; i > 0; i--)
		nfs_nfsiodnew(0);
out:
	mtx_unlock(&nfs_iod_mtx);	
	return (0);
}
Exemplo n.º 2
0
static void
nfsiod_setup(void *dummy)
{
	int i;
	int error;

	TUNABLE_INT_FETCH("vfs.nfs.iodmin", &nfs_iodmin);
	/* Silently limit the start number of nfsiod's */
	if (nfs_iodmin > NFS_MAXASYNCDAEMON)
		nfs_iodmin = NFS_MAXASYNCDAEMON;

	for (i = 0; i < nfs_iodmin; i++) {
		error = nfs_nfsiodnew();
		if (error == -1)
			panic("nfsiod_setup: nfs_nfsiodnew failed");
	}
}