diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/mount_zfs/Makefile.am | 5 | ||||
-rw-r--r-- | cmd/raidz_test/Makefile.am | 2 | ||||
-rw-r--r-- | cmd/zdb/Makefile.am | 4 | ||||
-rw-r--r-- | cmd/zed/Makefile.am | 9 | ||||
-rw-r--r-- | cmd/zfs/Makefile.am | 3 | ||||
-rw-r--r-- | cmd/zfs/zfs_main.c | 3 | ||||
-rw-r--r-- | cmd/zhack/Makefile.am | 4 | ||||
-rw-r--r-- | cmd/zinject/Makefile.am | 4 | ||||
-rw-r--r-- | cmd/zpool/Makefile.am | 7 | ||||
-rw-r--r-- | cmd/zpool/zpool_iter.c | 28 | ||||
-rw-r--r-- | cmd/zpool/zpool_main.c | 11 | ||||
-rw-r--r-- | cmd/zpool/zpool_util.c | 26 | ||||
-rw-r--r-- | cmd/zpool/zpool_util.h | 2 | ||||
-rw-r--r-- | cmd/zstreamdump/Makefile.am | 5 | ||||
-rw-r--r-- | cmd/ztest/Makefile.am | 5 |
15 files changed, 51 insertions, 67 deletions
diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am index b1d938922..bc9fb4c34 100644 --- a/cmd/mount_zfs/Makefile.am +++ b/cmd/mount_zfs/Makefile.am @@ -16,7 +16,4 @@ mount_zfs_SOURCES = \ mount_zfs_LDADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzpool/libzpool.la \ - $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzfs/libzfs.la diff --git a/cmd/raidz_test/Makefile.am b/cmd/raidz_test/Makefile.am index 15edb2b1e..02cc746ec 100644 --- a/cmd/raidz_test/Makefile.am +++ b/cmd/raidz_test/Makefile.am @@ -15,8 +15,6 @@ raidz_test_SOURCES = \ raidz_bench.c raidz_test_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ $(top_builddir)/lib/libzpool/libzpool.la raidz_test_LDADD += -lm -ldl diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am index eb8e6777f..ea6806b2c 100644 --- a/cmd/zdb/Makefile.am +++ b/cmd/zdb/Makefile.am @@ -14,7 +14,5 @@ zdb_SOURCES = \ zdb_LDADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzpool/libzpool.la diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am index 97733a512..53d5aa71c 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -40,15 +40,12 @@ FMA_SRC = \ zed_SOURCES = $(ZED_SRC) $(FMA_SRC) zed_LDADD = \ - $(top_builddir)/lib/libavl/libavl.la \ $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libspl/libspl.la \ $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzpool/libzpool.la \ - $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzfs/libzfs.la -zed_LDFLAGS = -lrt -pthread +zed_LDADD += -lrt +zed_LDFLAGS = -pthread zedconfdir = $(sysconfdir)/zfs/zed.d diff --git a/cmd/zfs/Makefile.am b/cmd/zfs/Makefile.am index e40909516..4e689d1ee 100644 --- a/cmd/zfs/Makefile.am +++ b/cmd/zfs/Makefile.am @@ -15,8 +15,5 @@ zfs_SOURCES = \ zfs_LDADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la - -zfs_LDFLAGS = -pthread diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index e8fe6a9fa..0d18ca7b6 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -55,6 +55,7 @@ #include <sys/mount.h> #include <sys/stat.h> #include <sys/fs/zfs.h> +#include <sys/systeminfo.h> #include <sys/types.h> #include <time.h> @@ -7045,8 +7046,6 @@ main(int argc, char **argv) (void) setlocale(LC_ALL, ""); (void) textdomain(TEXT_DOMAIN); - dprintf_setup(&argc, argv); - opterr = 0; /* diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am index a7bce5dde..f720e8286 100644 --- a/cmd/zhack/Makefile.am +++ b/cmd/zhack/Makefile.am @@ -11,7 +11,5 @@ zhack_SOURCES = \ zhack_LDADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzpool/libzpool.la diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am index 2500beec2..b709a2f5a 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -13,7 +13,5 @@ zinject_SOURCES = \ zinject_LDADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzpool/libzpool.la diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 6eff1d143..d7e1741c1 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -16,10 +16,9 @@ zpool_SOURCES = \ zpool_LDADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzpool/libzpool.la \ - $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - -lm $(LIBBLKID) + $(top_builddir)/lib/libzfs/libzfs.la + +zpool_LDADD += -lm $(LIBBLKID) zpoolconfdir = $(sysconfdir)/zfs/zpool.d zpoolexecdir = $(libexecdir)/zfs/zpool.d diff --git a/cmd/zpool/zpool_iter.c b/cmd/zpool/zpool_iter.c index e55c2f102..019f0b136 100644 --- a/cmd/zpool/zpool_iter.c +++ b/cmd/zpool/zpool_iter.c @@ -33,6 +33,7 @@ #include <stdio.h> #include <stdlib.h> #include <strings.h> +#include <thread_pool.h> #include <libzfs.h> #include <sys/zfs_context.h> @@ -668,34 +669,21 @@ all_pools_for_each_vdev_gather_cb(zpool_handle_t *zhp, void *cb_vcdl) static void all_pools_for_each_vdev_run_vcdl(vdev_cmd_data_list_t *vcdl) { - taskq_t *t; - int i; - /* 5 * boot_ncpus selfishly chosen since it works best on LLNL's HW */ - int max_threads = 5 * boot_ncpus; - - /* - * Under Linux we use a taskq to parallelize running a command - * on each vdev. It is therefore necessary to initialize this - * functionality for the duration of the threads. - */ - thread_init(); + tpool_t *t; - t = taskq_create("z_pool_cmd", max_threads, defclsyspri, max_threads, - INT_MAX, 0); + t = tpool_create(1, 5 * sysconf(_SC_NPROCESSORS_ONLN), 0, NULL); if (t == NULL) return; /* Spawn off the command for each vdev */ - for (i = 0; i < vcdl->count; i++) { - (void) taskq_dispatch(t, vdev_run_cmd_thread, - (void *) &vcdl->data[i], TQ_SLEEP); + for (int i = 0; i < vcdl->count; i++) { + (void) tpool_dispatch(t, vdev_run_cmd_thread, + (void *) &vcdl->data[i]); } /* Wait for threads to finish */ - taskq_wait(t); - taskq_destroy(t); - thread_fini(); - + tpool_wait(t); + tpool_destroy(t); } /* diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 338b9952c..60713197d 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -50,6 +50,7 @@ #include <zfs_prop.h> #include <sys/fs/zfs.h> #include <sys/stat.h> +#include <sys/systeminfo.h> #include <sys/fm/fs/zfs.h> #include <sys/fm/util.h> #include <sys/fm/protocol.h> @@ -2645,15 +2646,7 @@ zpool_do_import(int argc, char **argv) idata.cachefile = cachefile; idata.scan = do_scan; - /* - * Under Linux the zpool_find_import_impl() function leverages the - * taskq implementation to parallelize device scanning. It is - * therefore necessary to initialize this functionality for the - * duration of the zpool_search_import() function. - */ - thread_init(); pools = zpool_search_import(g_zfs, &idata); - thread_fini(); if (pools != NULL && idata.exists && (argc == 1 || strcmp(argv[0], argv[1]) == 0)) { @@ -7968,8 +7961,6 @@ main(int argc, char **argv) (void) textdomain(TEXT_DOMAIN); srand(time(NULL)); - dprintf_setup(&argc, argv); - opterr = 0; /* diff --git a/cmd/zpool/zpool_util.c b/cmd/zpool/zpool_util.c index 43abfa23b..c26c0eb39 100644 --- a/cmd/zpool/zpool_util.c +++ b/cmd/zpool/zpool_util.c @@ -111,3 +111,29 @@ isnumber(char *str) return (1); } + +/* + * Find highest one bit set. + * Returns bit number + 1 of highest bit that is set, otherwise returns 0. + */ +int +highbit64(uint64_t i) +{ + if (i == 0) + return (0); + + return (NBBY * sizeof (uint64_t) - __builtin_clzll(i)); +} + +/* + * Find lowest one bit set. + * Returns bit number + 1 of lowest bit that is set, otherwise returns 0. + */ +int +lowbit64(uint64_t i) +{ + if (i == 0) + return (0); + + return (__builtin_ffsll(i)); +} diff --git a/cmd/zpool/zpool_util.h b/cmd/zpool/zpool_util.h index aef2cff27..3afc82d54 100644 --- a/cmd/zpool/zpool_util.h +++ b/cmd/zpool/zpool_util.h @@ -43,6 +43,8 @@ void zpool_no_memory(void); uint_t num_logs(nvlist_t *nv); uint64_t array64_max(uint64_t array[], unsigned int len); int isnumber(char *str); +int highbit64(uint64_t i); +int lowbit64(uint64_t i); /* * Misc utility functions diff --git a/cmd/zstreamdump/Makefile.am b/cmd/zstreamdump/Makefile.am index b46958d65..f80b5018e 100644 --- a/cmd/zstreamdump/Makefile.am +++ b/cmd/zstreamdump/Makefile.am @@ -11,7 +11,4 @@ zstreamdump_SOURCES = \ zstreamdump_LDADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzpool/libzpool.la \ - $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzfs/libzfs.la diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am index 5167d0c1d..930a7ec3a 100644 --- a/cmd/ztest/Makefile.am +++ b/cmd/ztest/Makefile.am @@ -16,9 +16,8 @@ ztest_SOURCES = \ ztest_LDADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzpool/libzpool.la ztest_LDADD += -lm +ztest_LDFLAGS = -pthread |