Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Death to nfsiod!



details:   https://anonhg.NetBSD.org/src/rev/94783c3a033e
branches:  trunk
changeset: 484954:94783c3a033e
user:      tsarna <tsarna%NetBSD.org@localhost>
date:      Sat Apr 15 21:14:48 2000 +0000

description:
Death to nfsiod!

It is replaced by kernel threads that do the same thing. The number of
kernel threads used is set with the vfs.nfs.iothreads sysctl.

diffstat:

 etc/rc.conf              |   3 +-
 etc/rc.d/amd             |   4 +-
 etc/rc.d/nfsiod          |  16 -------------
 etc/rc.d/nfslocking      |   4 +-
 etc/rc.d/sysctl          |   9 ++++++-
 etc/sysctl.conf          |   9 ++++--
 lib/libc/sys/nfssvc.2    |  17 ++-----------
 share/man/man4/options.4 |   8 ++++-
 sys/nfs/nfs.h            |   9 +++++-
 sys/nfs/nfs_syscalls.c   |  59 ++++++++++++++++++++++++++++++++++++++++++-----
 sys/nfs/nfs_var.h        |   4 ++-
 sys/nfs/nfs_vfsops.c     |  15 +++++++++++-
 12 files changed, 104 insertions(+), 53 deletions(-)

diffs (truncated from 386 to 300 lines):

diff -r 00b4e4d51be6 -r 94783c3a033e etc/rc.conf
--- a/etc/rc.conf       Sat Apr 15 20:31:27 2000 +0000
+++ b/etc/rc.conf       Sat Apr 15 21:14:48 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: rc.conf,v 1.78 2000/04/09 21:00:04 tsarna Exp $
+#      $NetBSD: rc.conf,v 1.79 2000/04/15 21:14:48 tsarna Exp $
 #
 # see rc.conf(5) for more information.
 
@@ -112,7 +112,6 @@
 
 # NFS daemons and parameters
 nfs_client=NO                                  # enable client daemons
-                       nfsiod_flags="-n 4"
 nfs_server=NO                                  # enable server daemons
                        mountd_flags=""
                        nfsd_flags="-tun 4"
diff -r 00b4e4d51be6 -r 94783c3a033e etc/rc.d/amd
--- a/etc/rc.d/amd      Sat Apr 15 20:31:27 2000 +0000
+++ b/etc/rc.d/amd      Sat Apr 15 21:14:48 2000 +0000
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: amd,v 1.1.1.1 2000/03/10 11:53:25 lukem Exp $
+# $NetBSD: amd,v 1.2 2000/04/15 21:14:50 tsarna Exp $
 #
 
 # PROVIDE: amd
-# REQUIRE: nfsiod portmap mountall ypbind
+# REQUIRE: portmap mountall ypbind
 
 . /etc/rc.subr
 . /etc/rc.conf
diff -r 00b4e4d51be6 -r 94783c3a033e etc/rc.d/nfsiod
--- a/etc/rc.d/nfsiod   Sat Apr 15 20:31:27 2000 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-#!/bin/sh
-#
-# $NetBSD: nfsiod,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $
-#
-
-# PROVIDE: nfsiod
-# REQUIRE: beforemountlkm network portmap
-
-. /etc/rc.subr
-. /etc/rc.conf
-
-name="nfsiod"
-rcvar="nfs_client"
-command="/usr/sbin/${name}"
-
-run_rc_command "$1"
diff -r 00b4e4d51be6 -r 94783c3a033e etc/rc.d/nfslocking
--- a/etc/rc.d/nfslocking       Sat Apr 15 20:31:27 2000 +0000
+++ b/etc/rc.d/nfslocking       Sat Apr 15 21:14:48 2000 +0000
@@ -1,10 +1,10 @@
 #!/bin/sh
 #
-# $NetBSD: nfslocking,v 1.1.1.1 2000/03/10 11:53:24 lukem Exp $
+# $NetBSD: nfslocking,v 1.2 2000/04/15 21:14:50 tsarna Exp $
 #
 
 # PROVIDE: nfslocking
-# REQUIRE: nfsd nfsiod
+# REQUIRE: nfsd
 
 . /etc/rc.subr
 . /etc/rc.conf
diff -r 00b4e4d51be6 -r 94783c3a033e etc/rc.d/sysctl
--- a/etc/rc.d/sysctl   Sat Apr 15 20:31:27 2000 +0000
+++ b/etc/rc.d/sysctl   Sat Apr 15 21:14:48 2000 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: sysctl,v 1.3 2000/04/09 21:00:04 tsarna Exp $
+# $NetBSD: sysctl,v 1.4 2000/04/15 21:14:51 tsarna Exp $
 #
 
 # PROVIDE: sysctl
@@ -23,6 +23,13 @@
 __EOF__
        fi
 
+       if [ "X$nfsiod_flags" != "X" ]; then
+               cat <<__EOF__
+*** WARNING: /etc/rc.conf \$nfsiod_flags setting is obsolete. Please
+*** set vfs.nfs.iothreads in /etc/sysctl.conf if using NFS client.
+__EOF__
+       fi
+
        #       if $securelevel is set, change it here, else if it is 0,
        #       change it to 1 here, before we start login services.
        #
diff -r 00b4e4d51be6 -r 94783c3a033e etc/sysctl.conf
--- a/etc/sysctl.conf   Sat Apr 15 20:31:27 2000 +0000
+++ b/etc/sysctl.conf   Sat Apr 15 21:14:48 2000 +0000
@@ -1,8 +1,11 @@
 #!/sbin/sysctl -f
 #
-# $NetBSD: sysctl.conf,v 1.2 2000/04/09 21:00:04 tsarna Exp $
+# $NetBSD: sysctl.conf,v 1.3 2000/04/15 21:14:49 tsarna Exp $
 #
 # sysctl(8) variables to set at boot time.
 
-# default core name template:
-#kern.defcorename=core
+# Default core name template:
+#kern.defcorename=%n.core
+
+# Number of kernel threads to use for NFS client
+#vfs.nfs.iothreads=4
diff -r 00b4e4d51be6 -r 94783c3a033e lib/libc/sys/nfssvc.2
--- a/lib/libc/sys/nfssvc.2     Sat Apr 15 20:31:27 2000 +0000
+++ b/lib/libc/sys/nfssvc.2     Sat Apr 15 21:14:48 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: nfssvc.2,v 1.10 1999/12/11 19:35:48 msaitoh Exp $
+.\"    $NetBSD: nfssvc.2,v 1.11 2000/04/15 21:14:51 tsarna Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -60,20 +60,9 @@
 flags.
 .Pp
 On the client side,
-.Xr nfsiod 8
-calls
 .Fn nfssvc
-with the
-.Fa flags
-argument set to
-.Dv NFSSVC_BIOD
-and
-.Fa argstructp
-set to
-.Dv NULL
-to enter the kernel as a block I/O server daemon.
-For
-.Nm NQNFS ,
+is only used for
+.Nm NQNFS .
 .Xr mount_nfs 8
 calls
 .Fn nfssvc
diff -r 00b4e4d51be6 -r 94783c3a033e share/man/man4/options.4
--- a/share/man/man4/options.4  Sat Apr 15 20:31:27 2000 +0000
+++ b/share/man/man4/options.4  Sat Apr 15 21:14:48 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: options.4,v 1.104 2000/04/13 20:05:52 jhawk Exp $
+.\"    $NetBSD: options.4,v 1.105 2000/04/15 21:14:51 tsarna Exp $
 .\"
 .\" Copyright (c) 1996
 .\"    Perry E. Metzger.  All rights reserved.
@@ -142,7 +142,11 @@
 .Xr ioctl 2
 on
 .Xr wscons 4
-to be performed.
+to be performed, and allows the
+.Dv NFSSVC_BIOD
+mode of the
+.Xr nfssvc 2
+system call to be used for compatibility with the deprecated nfsiod program.
 .It Cd options COMPAT_43
 Enables compatibility with
 .Bx 4.3 .
diff -r 00b4e4d51be6 -r 94783c3a033e sys/nfs/nfs.h
--- a/sys/nfs/nfs.h     Sat Apr 15 20:31:27 2000 +0000
+++ b/sys/nfs/nfs.h     Sat Apr 15 21:14:48 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs.h,v 1.20 1998/11/13 20:09:54 thorpej Exp $ */
+/*     $NetBSD: nfs.h,v 1.21 2000/04/15 21:14:52 tsarna Exp $  */
 /*
  * Copyright (c) 1989, 1993, 1995
  *     The Regents of the University of California.  All rights reserved.
@@ -68,6 +68,9 @@
 #define        NFS_MAXRAHEAD   4               /* Max. read ahead # blocks */
 #define        NFS_MAXUIDHASH  64              /* Max. # of hashed uid entries/mp */
 #define        NFS_MAXASYNCDAEMON      20      /* Max. number async_daemons runable */
+#ifdef _KERNEL
+extern int nfs_niothreads;              /* Number of async_daemons desired */
+#endif
 #define NFS_MAXGATHERDELAY     100     /* Max. write gather delay (msec) */
 #ifndef NFS_GATHERDELAY
 #define NFS_GATHERDELAY                10      /* Default write gather delay (msec) */
@@ -238,11 +241,13 @@
  * fs.nfs sysctl(3) identifiers
  */
 #define NFS_NFSSTATS   1               /* struct: struct nfsstats */
-#define        NFS_MAXID       2
+#define NFS_IOTHREADS  2               /* number of io threads */
+#define        NFS_MAXID       3
 
 #define NFS_NAMES { \
        { 0, 0 }, \
        { "nfsstats", CTLTYPE_STRUCT }, \
+       { "iothreads", CTLTYPE_INT }, \
 }
 
 /*
diff -r 00b4e4d51be6 -r 94783c3a033e sys/nfs/nfs_syscalls.c
--- a/sys/nfs/nfs_syscalls.c    Sat Apr 15 20:31:27 2000 +0000
+++ b/sys/nfs/nfs_syscalls.c    Sat Apr 15 21:14:48 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_syscalls.c,v 1.38 2000/03/30 12:51:16 augustss Exp $       */
+/*     $NetBSD: nfs_syscalls.c,v 1.39 2000/04/15 21:14:52 tsarna Exp $ */
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,6 +41,7 @@
 #include "fs_nfs.h"
 #include "opt_nfsserver.h"
 #include "opt_iso.h"
+#include "opt_compat_netbsd.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,11 +57,13 @@
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <sys/socketvar.h>
+#include <sys/signalvar.h>
 #include <sys/domain.h>
 #include <sys/protosw.h>
 #include <sys/namei.h>
 #include <sys/syslog.h>
 #include <sys/filedesc.h>
+#include <sys/kthread.h>
 
 #include <sys/syscallargs.h>
 
@@ -105,7 +108,8 @@
 #define        FALSE   0
 
 #ifdef NFS
-static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
+static struct proc *nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
+int nfs_niothreads = 0;
 #endif
 
 #ifdef NFSSERVER
@@ -161,7 +165,7 @@
                (void) tsleep((caddr_t)&nfssvc_sockhead, PSOCK, "nfsd init", 0);
        }
        if (SCARG(uap, flag) & NFSSVC_BIOD) {
-#ifdef NFS
+#if defined(NFS) && defined(COMPAT_14)
                error = nfssvc_iod(p);
 #else
                error = ENOSYS;
@@ -882,10 +886,11 @@
 
 int nfs_defect = 0;
 /*
- * Asynchronous I/O daemons for client nfs.
+ * Asynchronous I/O threads for client nfs.
  * They do read-ahead and write-behind operations on the block I/O cache.
  * Never returns unless it fails or gets killed.
  */
+
 int
 nfssvc_iod(p)
        struct proc *p;
@@ -900,13 +905,13 @@
         */
        myiod = -1;
        for (i = 0; i < NFS_MAXASYNCDAEMON; i++)
-               if (nfs_asyncdaemon[i] == 0) {
+               if (nfs_asyncdaemon[i] == NULL) {
                        myiod = i;
                        break;
                }
        if (myiod == -1)
                return (EBUSY);
-       nfs_asyncdaemon[myiod] = 1;
+       nfs_asyncdaemon[myiod] = p;
        nfs_numasync++;
        p->p_holdcnt++;
        /*
@@ -953,11 +958,51 @@
            }
        }
        p->p_holdcnt--;
-       nfs_asyncdaemon[myiod] = 0;
+       nfs_asyncdaemon[myiod] = NULL;
        nfs_numasync--;
+
        return (error);
 }
 
+void
+start_nfsio(arg)
+       void *arg;
+{
+       nfssvc_iod(curproc);
+       
+       kthread_exit(0);
+}
+
+void



Home | Main Index | Thread Index | Old Index