Source-Changes-HG archive

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

[src/trunk]: src Cleanup modules "solaris" and "zfs":



details:   https://anonhg.NetBSD.org/src/rev/88b0f6c7cb4d
branches:  trunk
changeset: 451127:88b0f6c7cb4d
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue May 07 08:51:09 2019 +0000

description:
Cleanup modules "solaris" and "zfs":

- Defer spa_config_load() until root is mounted.
- Restore the config path to "/etc/zfs/zpool.cache".
- Module "zfs" is type MODULE_CLASS_VFS and no longer depends on "rootvnode".
- Module "solaris" no longer depends on "mp_online".
- Fix rump component registration to not detach "/dev/zfs" if
  it didn't attach it.

diffstat:

 external/cddl/osnet/dist/uts/common/fs/zfs/spa_misc.c  |   8 ++++++++
 external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c |   5 +----
 external/cddl/osnet/dist/uts/common/sys/fs/zfs.h       |   2 +-
 external/cddl/osnet/sys/kern/mod.c                     |   7 ++-----
 sys/rump/fs/lib/libzfs/zfs_component.c                 |  11 +++++++----
 5 files changed, 19 insertions(+), 14 deletions(-)

diffs (129 lines):

diff -r 6981445deaa9 -r 88b0f6c7cb4d external/cddl/osnet/dist/uts/common/fs/zfs/spa_misc.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/spa_misc.c     Tue May 07 08:49:59 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/spa_misc.c     Tue May 07 08:51:09 2019 +0000
@@ -60,6 +60,10 @@
 #include <sys/sysctl.h>
 #endif
 
+#if defined( __NetBSD__) && defined(_KERNEL)
+#include <sys/device.h>
+#endif
+
 /*
  * SPA locking
  *
@@ -2071,7 +2075,11 @@
        zfs_prop_init();
        zpool_prop_init();
        zpool_feature_init();
+#if defined(__NetBSD__) && defined(_KERNEL)
+       config_mountroot((device_t) 0, (void (*)(device_t)) spa_config_load);
+#else
        spa_config_load();
+#endif
        l2arc_start();
 #ifdef __FreeBSD__
 #ifdef _KERNEL
diff -r 6981445deaa9 -r 88b0f6c7cb4d external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c    Tue May 07 08:49:59 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c    Tue May 07 08:51:09 2019 +0000
@@ -6973,7 +6973,7 @@
 #include <sys/module.h>
 #include <uvm/uvm_extern.h>
 
-MODULE(MODULE_CLASS_DRIVER, zfs, "solaris");
+MODULE(MODULE_CLASS_VFS, zfs, "solaris");
 
 static const struct fileops zfs_fileops;
 
@@ -7180,9 +7180,6 @@
 
        switch (cmd) {
        case MODULE_CMD_INIT:
-               if (!rootvnode)
-                       return EAGAIN;
-
                /* XXXNETBSD trim is not supported yet */
                zfs_trim_enabled = B_FALSE;
 
diff -r 6981445deaa9 -r 88b0f6c7cb4d external/cddl/osnet/dist/uts/common/sys/fs/zfs.h
--- a/external/cddl/osnet/dist/uts/common/sys/fs/zfs.h  Tue May 07 08:49:59 2019 +0000
+++ b/external/cddl/osnet/dist/uts/common/sys/fs/zfs.h  Tue May 07 08:51:09 2019 +0000
@@ -630,7 +630,7 @@
 #define        ZPOOL_CACHE             "/boot/zfs/zpool.cache"
 #endif
 #ifdef __NetBSD__
-#define        ZPOOL_CACHE             "/var/db/zfs/zpool.cache"
+#define        ZPOOL_CACHE             "/etc/zfs/zpool.cache"
 #endif
 
 /*
diff -r 6981445deaa9 -r 88b0f6c7cb4d external/cddl/osnet/sys/kern/mod.c
--- a/external/cddl/osnet/sys/kern/mod.c        Tue May 07 08:49:59 2019 +0000
+++ b/external/cddl/osnet/sys/kern/mod.c        Tue May 07 08:51:09 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mod.c,v 1.4 2018/12/13 10:19:47 hannken Exp $  */
+/*     $NetBSD: mod.c,v 1.5 2019/05/07 08:51:09 hannken Exp $  */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mod.c,v 1.4 2018/12/13 10:19:47 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mod.c,v 1.5 2019/05/07 08:51:09 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -49,9 +49,6 @@
 
        switch (cmd) {
        case MODULE_CMD_INIT:
-               if (!mp_online)
-                       return EAGAIN;
-
                opensolaris_utsname_init();
                callb_init(NULL);
                taskq_init();
diff -r 6981445deaa9 -r 88b0f6c7cb4d sys/rump/fs/lib/libzfs/zfs_component.c
--- a/sys/rump/fs/lib/libzfs/zfs_component.c    Tue May 07 08:49:59 2019 +0000
+++ b/sys/rump/fs/lib/libzfs/zfs_component.c    Tue May 07 08:51:09 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zfs_component.c,v 1.2 2016/01/26 23:12:17 pooka Exp $  */
+/*     $NetBSD: zfs_component.c,v 1.3 2019/05/07 08:51:09 hannken Exp $        */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zfs_component.c,v 1.2 2016/01/26 23:12:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zfs_component.c,v 1.3 2019/05/07 08:51:09 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -41,7 +41,7 @@
        extern const struct bdevsw zfs_bdevsw;
        extern const struct cdevsw zfs_cdevsw;
        devmajor_t bmaj, cmaj;
-       int error;
+       int error, exist;
 
        /* go, mydevfs */
        bmaj = cmaj = -1;
@@ -49,9 +49,12 @@
        if ((error = devsw_attach("zfs", &zfs_bdevsw, &bmaj,
            &zfs_cdevsw, &cmaj)) != 0 && error != EEXIST)
                panic("cannot attach zfs: %d", error);
+       exist = (error == EEXIST);
 
        if ((error = rump_vfs_makeonedevnode(S_IFCHR,
            "/dev/zfs", cmaj, 0)) != 0)
                panic("cannot create zfs dev nodes: %d", error);
-       devsw_detach(&zfs_bdevsw, &zfs_cdevsw);
+
+       if (!exist)
+               devsw_detach(&zfs_bdevsw, &zfs_cdevsw);
 }



Home | Main Index | Thread Index | Old Index