summaryrefslogtreecommitdiffstats
path: root/module/zcommon/zfs_fletcher.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2017-08-09 15:31:08 -0700
committerGitHub <[email protected]>2017-08-09 15:31:08 -0700
commit46364cb2f35545a7fc915df9593b719a94c43a83 (patch)
tree0fb11534892c2aaaa1c1bda3c10914e718827eb0 /module/zcommon/zfs_fletcher.c
parent5146d802b4e371cab1d6db79bea482c056be7bf2 (diff)
Add libtpool (thread pools)
OpenZFS provides a library called tpool which implements thread pools for user space applications. Porting this library means the zpool utility no longer needs to borrow the kernel mutex and taskq interfaces from libzpool. This code was updated to use the tpool library which behaves in a very similar fashion. Porting libtpool was relatively straight forward and minimal modifications were needed. The core changes were: * Fully convert the library to use pthreads. * Updated signal handling. * lmalloc/lfree converted to calloc/free * Implemented portable pthread_attr_clone() function. Finally, update the build system such that libzpool.so is no longer linked in to zfs(8), zpool(8), etc. All that is required is libzfs to which the zcommon soures were added (which is the way it always should have been). Removing the libzpool dependency resulted in several build issues which needed to be resolved. * Moved zfeature support to module/zcommon/zfeature_common.c * Moved ratelimiting to to module/zfs/zfs_ratelimit.c * Moved get_system_hostid() to lib/libspl/gethostid.c * Removed use of cmn_err() in zcommon source * Removed dprintf_setup() call from zpool_main.c and zfs_main.c * Removed highbit() and lowbit() * Removed unnecessary library dependencies from Makefiles * Removed fletcher-4 kstat in user space * Added sha2 support explicitly to libzfs * Added highbit64() and lowbit64() to zpool_util.c Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #6442
Diffstat (limited to 'module/zcommon/zfs_fletcher.c')
-rw-r--r--module/zcommon/zfs_fletcher.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/module/zcommon/zfs_fletcher.c b/module/zcommon/zfs_fletcher.c
index 9cdf36d44..0cd992979 100644
--- a/module/zcommon/zfs_fletcher.c
+++ b/module/zcommon/zfs_fletcher.c
@@ -212,7 +212,9 @@ static struct fletcher_4_impl_selector {
{ "scalar", IMPL_SCALAR }
};
+#if defined(_KERNEL)
static kstat_t *fletcher_4_kstat;
+#endif
static struct fletcher_4_kstat {
uint64_t native;
@@ -589,7 +591,7 @@ fletcher_4_incremental_byteswap(void *buf, size_t size, void *data)
return (0);
}
-
+#if defined(_KERNEL)
/* Fletcher 4 kstats */
static int
@@ -642,6 +644,7 @@ fletcher_4_kstat_addr(kstat_t *ksp, loff_t n)
return (ksp->ks_private);
}
+#endif
#define FLETCHER_4_FASTEST_FN_COPY(type, src) \
{ \
@@ -753,6 +756,7 @@ fletcher_4_init(void)
vmem_free(databuf, data_size);
+#if defined(_KERNEL)
/* install kstats for all implementations */
fletcher_4_kstat = kstat_create("zfs", 0, "fletcher_4_bench", "misc",
KSTAT_TYPE_RAW, 0, KSTAT_FLAG_VIRTUAL);
@@ -765,6 +769,7 @@ fletcher_4_init(void)
fletcher_4_kstat_addr);
kstat_install(fletcher_4_kstat);
}
+#endif
/* Finish initialization */
fletcher_4_initialized = B_TRUE;
@@ -773,10 +778,12 @@ fletcher_4_init(void)
void
fletcher_4_fini(void)
{
+#if defined(_KERNEL)
if (fletcher_4_kstat != NULL) {
kstat_delete(fletcher_4_kstat);
fletcher_4_kstat = NULL;
}
+#endif
}
/* ABD adapters */