#include <sys/fs/zfs.h>
#include <zfs_fletcher.h>
#include <libnvpair.h>
-#include <libzfs.h>
+#include <libzutil.h>
#include <sys/crypto/icp.h>
#ifdef __GLIBC__
#include <execinfo.h> /* for backtrace() */
.zo_init = 1,
.zo_time = 300, /* 5 minutes */
.zo_maxloops = 50, /* max loops during spa_freeze() */
- .zo_metaslab_force_ganging = 32 << 10,
+ .zo_metaslab_force_ganging = 64 << 10,
.zo_special_vdevs = ZTEST_VDEV_CLASS_RND,
};
ztest_device_removal_active = B_TRUE;
mutex_exit(&ztest_vdev_lock);
+ /*
+ * spa->spa_vdev_removal is created in a sync task that
+ * is initiated via dsl_sync_task_nowait(). Since the
+ * task may not run before spa_vdev_remove() returns, we
+ * must wait at least 1 txg to ensure that the removal
+ * struct has been created.
+ */
+ txg_wait_synced(spa_get_dsl(spa), 0);
+
while (spa->spa_vdev_removal != NULL)
txg_wait_synced(spa_get_dsl(spa), 0);
} else {
static void
ztest_import(ztest_shared_t *zs)
{
- libzfs_handle_t *hdl;
importargs_t args = { 0 };
spa_t *spa;
nvlist_t *cfg = NULL;
VERIFY0(pthread_rwlock_init(&ztest_name_lock, NULL));
kernel_init(FREAD | FWRITE);
- hdl = libzfs_init();
searchdirs[0] = ztest_opts.zo_dir;
args.paths = nsearch;
args.path = searchdirs;
args.can_be_active = B_FALSE;
- error = zpool_tryimport(hdl, name, &cfg, &args);
+ error = zpool_find_config(NULL, name, &cfg, &args,
+ &libzpool_config_ops);
if (error)
(void) fatal(0, "No pools found\n");
1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift;
spa_close(spa, FTAG);
- libzfs_fini(hdl);
kernel_fini();
if (!ztest_opts.zo_mmp_test) {