Be consistent about _KERNEL vs _HARDKERNEL in zfs.

As it happens, on x86 both _HARDKERNEL and _KERNEL get defined; see
the conditional in sys/rump/Makefile.rump that _refrains_ from
defining _RUMPKERNEL on x86.

So the only version of this code that has been tested is the one with
all of it included.  But on, e.g., aarch64, we do not get _HARDKERNEL
here, and the code fails to build because some things use the field
struct spa::spa_deadman_cycid under _KERNEL when it is declared only
under _HARDKERNEL.

If there's a reason _not_ to use this in rump -- and it's not obvious
to me why -- then all access to the field needs to agree to use
_HARDKERNEL.
This commit is contained in:
riastradh 2018-11-15 04:55:38 +00:00
parent 3c01401a94
commit 6af8fc2044
2 changed files with 8 additions and 8 deletions

View File

@ -391,7 +391,7 @@ zfs_deadman_init(void)
#endif /* __FreeBSD__ */
#ifdef __NetBSD__
#ifdef _HARDKERNEL
#ifdef _KERNEL
static struct workqueue *spa_workqueue;
static void spa_deadman(void *arg);
@ -420,10 +420,10 @@ zfs_deadman_fini(void)
workqueue_destroy(spa_workqueue);
spa_workqueue = NULL;
}
#else /* !_HARDKERNEL */
#else /* !_KERNEL */
#define zfs_deadman_init() /* nothing */
#define zfs_deadman_fini() /* nothing */
#endif /* !_HARDKERNEL */
#endif /* !_KERNEL */
#endif /* __NetBSD__ */
/*
@ -664,7 +664,7 @@ spa_deadman(void *arg)
#endif
}
#ifdef _HARDKERNEL
#ifdef _KERNEL
static void
spa_deadman_timeout(void *arg)
{
@ -771,7 +771,7 @@ spa_add(const char *name, nvlist_t *config, const char *altroot)
#endif
#endif
#ifdef __NetBSD__
#ifdef _HARDKERNEL
#ifdef _KERNEL
callout_init(&spa->spa_deadman_cycid, 0);
callout_setfunc(&spa->spa_deadman_cycid, spa_deadman_timeout, spa);
#endif
@ -892,7 +892,7 @@ spa_remove(spa_t *spa)
#endif
#endif
#ifdef __NetBSD__
#ifdef _HARDKERNEL
#ifdef _KERNEL
callout_drain(&spa->spa_deadman_cycid);
#endif
#endif

View File

@ -44,7 +44,7 @@
#include <sys/zfeature.h>
#include <zfeature_common.h>
#if defined(__NetBSD__) && defined(_HARDKERNEL)
#if defined(__NetBSD__) && defined(_KERNEL)
#include <sys/workqueue.h>
#endif
@ -276,7 +276,7 @@ struct spa {
#endif
#endif /* __FreeBSD__ */
#ifdef __NetBSD__
#ifdef _HARDKERNEL
#ifdef _KERNEL
struct callout spa_deadman_cycid; /* callout id */
struct work spa_deadman_work;
#endif