summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-09-12 12:55:46 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-09-12 12:55:46 +0000
commit30ca5be371ae8bf0864285e4837c621d50c7f1eb (patch)
treedce4dcacee95c7d99aaf8c1450f7d5d1e7c09d01 /usr/src/lib
parenta684d52c70031374c438f8d0fecbbf3e872c9753 (diff)
parentce115d25b7c5f8cff5a9444c4d0d1ea9d31c2056 (diff)
downloadillumos-joyent-30ca5be371ae8bf0864285e4837c621d50c7f1eb.tar.gz
[illumos-gate merge]
commit ce115d25b7c5f8cff5a9444c4d0d1ea9d31c2056 11657 Remove old ctf tools commit 8eb8717cc9dc99bdd784b74c994bea7ef5e60f92 11626 introduce /etc/versions/build 11627 clean up UUID code for ::status commit 169b638e2b6e15b2589c3769e4a0d96188adf56d 11649 loader.efi: some systems do not translate scan code 0x8 to backspace commit 81ff72c5f2cea16235aa4a42d83d07e20090498d 11606 process erroneously shows up as from 1970 commit 3125066d426d7d7cd25d89b474290bc4b5817846 11661 provide C.UTF-8 locale commit 8a2c2d71876be7abb6367a98b63affe135ad8cc5 11673 Error setting file times with smbfs and Apple SMB server commit 084fd14f7c3336eb67ee283cabad2da8998b00d6 1701 ZFS to support UNMAP/TRIM for SSD commit ada70d038ca186abd71e023e9dec2c5148e9b36f 11648 loader.efi: comconsole should set EFI_SERIAL_REQUEST_TO_SEND bit commit d7802caee060fef7fc8e8c54b5f61e9efe26ff1e 11634 installboot should support ESP updates Conflicts: usr/src/cmd/mdb/common/modules/mdb_ks/mdb_ks.c usr/src/cmd/nsadmin/Makefile usr/src/cmd/svc/svcs/Makefile usr/src/cmd/svc/svcs/svcs.c usr/src/uts/common/fs/zfs/metaslab.c usr/src/uts/common/fs/zfs/sys/metaslab_impl.h
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/libbe/common/be_activate.c13
-rw-r--r--usr/src/lib/libbe/common/libbe_priv.h3
-rw-r--r--usr/src/lib/libc/port/locale/localeimpl.c17
-rw-r--r--usr/src/lib/libzfs/common/libzfs.h19
-rw-r--r--usr/src/lib/libzfs/common/libzfs_pool.c210
-rw-r--r--usr/src/lib/libzfs/common/libzfs_util.c11
-rw-r--r--usr/src/lib/libzfs/common/mapfile-vers2
-rw-r--r--usr/src/lib/libzfs_core/common/libzfs_core.c46
-rw-r--r--usr/src/lib/libzfs_core/common/libzfs_core.h3
-rw-r--r--usr/src/lib/libzfs_core/common/mapfile-vers6
-rw-r--r--usr/src/lib/libzpool/common/sys/zfs_context.h3
11 files changed, 281 insertions, 52 deletions
diff --git a/usr/src/lib/libbe/common/be_activate.c b/usr/src/lib/libbe/common/be_activate.c
index 9fd95e1e8a..1c2454991d 100644
--- a/usr/src/lib/libbe/common/be_activate.c
+++ b/usr/src/lib/libbe/common/be_activate.c
@@ -961,9 +961,13 @@ be_do_installboot_helper(zpool_handle_t *zphp, nvlist_t *child, char *stage1,
"%s %s %s %s %s", BE_INSTALL_GRUB, flag,
stage1, stage2, diskname);
} else {
+ /*
+ * With updated installboot, we only need boot
+ * directory.
+ */
(void) snprintf(install_cmd, sizeof (install_cmd),
- "%s %s %s %s %s", BE_INSTALL_BOOT, flag,
- stage1, stage2, diskname);
+ "%s %s -b %s %s", BE_INSTALL_BOOT, flag,
+ stage1, diskname);
}
} else if (be_is_isa("sparc")) {
if ((flags & BE_INSTALLBOOT_FLAG_FORCE) ==
@@ -1326,9 +1330,8 @@ be_do_installboot(be_transaction_data_t *bt, uint16_t flags)
tmp_mntpt, BE_GRUB_STAGE_2);
} else {
(void) snprintf(stage1, sizeof (stage1), "%s%s",
- tmp_mntpt, BE_LOADER_STAGE_1);
- (void) snprintf(stage2, sizeof (stage2), "%s%s",
- tmp_mntpt, BE_LOADER_STAGE_2);
+ tmp_mntpt, BE_LOADER_STAGES);
+ /* Skip stage2 */
}
} else if (be_is_isa("sparc")) {
char *platform = be_get_platform();
diff --git a/usr/src/lib/libbe/common/libbe_priv.h b/usr/src/lib/libbe/common/libbe_priv.h
index cdae3a7413..cbd382242b 100644
--- a/usr/src/lib/libbe/common/libbe_priv.h
+++ b/usr/src/lib/libbe/common/libbe_priv.h
@@ -63,8 +63,7 @@ extern "C" {
#define BE_GRUB_STAGE_1 "/boot/grub/stage1"
#define BE_GRUB_STAGE_2 "/boot/grub/stage2"
#define BE_INSTALL_BOOT "/usr/sbin/installboot"
-#define BE_LOADER_STAGE_1 "/boot/pmbr"
-#define BE_LOADER_STAGE_2 "/boot/gptzfsboot"
+#define BE_LOADER_STAGES "/boot"
#define BE_SPARC_BOOTBLK "/lib/fs/zfs/bootblk"
#define ZFS_CLOSE(_zhp) \
diff --git a/usr/src/lib/libc/port/locale/localeimpl.c b/usr/src/lib/libc/port/locale/localeimpl.c
index 9083e0f16b..24c03d558a 100644
--- a/usr/src/lib/libc/port/locale/localeimpl.c
+++ b/usr/src/lib/libc/port/locale/localeimpl.c
@@ -128,6 +128,20 @@ __global_locale(void)
}
/*
+ * Locale data for hybrid C.UTF-8 locale having all the characteristics of
+ * default C/POSIX locale, except for LC_CTYPE data which is retrieved from
+ * cache/file as for other UTF-8 locales.
+ */
+static struct locdata cutf_locdata[LC_ALL] = {
+ { "C.UTF-8", NULL }, /* unused */
+ { "C.UTF-8", &lc_numeric_posix },
+ { "C.UTF-8", &lc_time_posix },
+ { "C.UTF-8", &lc_collate_posix },
+ { "C.UTF-8", &lc_monetary_posix },
+ { "C.UTF-8", &lc_messages_posix },
+};
+
+/*
* Category names for getenv() Note that this was modified
* for Solaris. See <iso/locale_iso.h>.
*/
@@ -315,6 +329,9 @@ locdata_get(int category, const char *locname)
if ((strcmp(locname, "C") == 0) || (strcmp(locname, "POSIX") == 0))
return (posix_locale.locdata[category]);
+ if ((strcmp(locname, "C.UTF-8") == 0) && (category != LC_CTYPE))
+ return (&cutf_locdata[category]);
+
return (locdata_get_cache(category, locname));
}
diff --git a/usr/src/lib/libzfs/common/libzfs.h b/usr/src/lib/libzfs/common/libzfs.h
index 49008ad38d..22d04862c7 100644
--- a/usr/src/lib/libzfs/common/libzfs.h
+++ b/usr/src/lib/libzfs/common/libzfs.h
@@ -132,6 +132,7 @@ typedef enum zfs_error {
EZFS_POOLREADONLY, /* pool is in read-only mode */
EZFS_SCRUB_PAUSED, /* scrub currently paused */
EZFS_ACTIVE_POOL, /* pool is imported on a different system */
+ EZFS_CRYPTOFAILED, /* failed to setup encryption */
EZFS_NO_PENDING, /* cannot cancel, no operation is pending */
EZFS_CHECKPOINT_EXISTS, /* checkpoint exists */
EZFS_DISCARDING_CHECKPOINT, /* currently discarding a checkpoint */
@@ -142,8 +143,10 @@ typedef enum zfs_error {
EZFS_INITIALIZING, /* currently initializing */
EZFS_NO_INITIALIZE, /* no active initialize */
EZFS_WRONG_PARENT, /* invalid parent dataset (e.g ZVOL) */
+ EZFS_TRIMMING, /* currently trimming */
+ EZFS_NO_TRIM, /* no active trim */
+ EZFS_TRIM_NOTSUP, /* device does not support trim */
EZFS_NO_RESILVER_DEFER, /* pool doesn't support resilver_defer */
- EZFS_CRYPTOFAILED, /* failed to setup encryption */
EZFS_UNKNOWN
} zfs_error_t;
@@ -266,12 +269,26 @@ typedef struct splitflags {
int name_flags;
} splitflags_t;
+typedef struct trimflags {
+ /* requested vdevs are for the entire pool */
+ boolean_t fullpool;
+
+ /* request a secure trim, requires support from device */
+ boolean_t secure;
+
+ /* trim at the requested rate in bytes/second */
+ uint64_t rate;
+} trimflags_t;
+
/*
* Functions to manipulate pool and vdev state
*/
extern int zpool_scan(zpool_handle_t *, pool_scan_func_t, pool_scrub_cmd_t);
extern int zpool_initialize(zpool_handle_t *, pool_initialize_func_t,
nvlist_t *);
+extern int zpool_trim(zpool_handle_t *, pool_trim_func_t, nvlist_t *,
+ trimflags_t *);
+
extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *);
extern int zpool_reguid(zpool_handle_t *);
extern int zpool_reopen(zpool_handle_t *);
diff --git a/usr/src/lib/libzfs/common/libzfs_pool.c b/usr/src/lib/libzfs/common/libzfs_pool.c
index b425d4e944..2d7bf01982 100644
--- a/usr/src/lib/libzfs/common/libzfs_pool.c
+++ b/usr/src/lib/libzfs/common/libzfs_pool.c
@@ -2033,6 +2033,57 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
}
/*
+ * Translate vdev names to guids. If a vdev_path is determined to be
+ * unsuitable then a vd_errlist is allocated and the vdev path and errno
+ * are added to it.
+ */
+static int
+zpool_translate_vdev_guids(zpool_handle_t *zhp, nvlist_t *vds,
+ nvlist_t *vdev_guids, nvlist_t *guids_to_paths, nvlist_t **vd_errlist)
+{
+ nvlist_t *errlist = NULL;
+ int error = 0;
+
+ for (nvpair_t *elem = nvlist_next_nvpair(vds, NULL); elem != NULL;
+ elem = nvlist_next_nvpair(vds, elem)) {
+ boolean_t spare, cache;
+
+ char *vd_path = nvpair_name(elem);
+ nvlist_t *tgt = zpool_find_vdev(zhp, vd_path, &spare, &cache,
+ NULL);
+
+ if ((tgt == NULL) || cache || spare) {
+ if (errlist == NULL) {
+ errlist = fnvlist_alloc();
+ error = EINVAL;
+ }
+
+ uint64_t err = (tgt == NULL) ? EZFS_NODEVICE :
+ (spare ? EZFS_ISSPARE : EZFS_ISL2CACHE);
+ fnvlist_add_int64(errlist, vd_path, err);
+ continue;
+ }
+
+ uint64_t guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
+ fnvlist_add_uint64(vdev_guids, vd_path, guid);
+
+ char msg[MAXNAMELEN];
+ (void) snprintf(msg, sizeof (msg), "%llu", (u_longlong_t)guid);
+ fnvlist_add_string(guids_to_paths, msg, vd_path);
+ }
+
+ if (error != 0) {
+ verify(errlist != NULL);
+ if (vd_errlist != NULL)
+ *vd_errlist = errlist;
+ else
+ fnvlist_free(errlist);
+ }
+
+ return (error);
+}
+
+/*
* Scan the pool.
*/
int
@@ -2133,72 +2184,151 @@ zpool_initialize(zpool_handle_t *zhp, pool_initialize_func_t cmd_type,
nvlist_t *vds)
{
char msg[1024];
- libzfs_handle_t *hdl = zhp->zpool_hdl;
-
- nvlist_t *errlist;
+ int err;
- /* translate vdev names to guids */
nvlist_t *vdev_guids = fnvlist_alloc();
nvlist_t *guids_to_paths = fnvlist_alloc();
- boolean_t spare, cache;
- nvlist_t *tgt;
+ nvlist_t *vd_errlist = NULL;
+ nvlist_t *errlist;
nvpair_t *elem;
- for (elem = nvlist_next_nvpair(vds, NULL); elem != NULL;
- elem = nvlist_next_nvpair(vds, elem)) {
- char *vd_path = nvpair_name(elem);
- tgt = zpool_find_vdev(zhp, vd_path, &spare, &cache, NULL);
+ err = zpool_translate_vdev_guids(zhp, vds, vdev_guids,
+ guids_to_paths, &vd_errlist);
- if ((tgt == NULL) || cache || spare) {
- (void) snprintf(msg, sizeof (msg),
- dgettext(TEXT_DOMAIN, "cannot initialize '%s'"),
- vd_path);
- int err = (tgt == NULL) ? EZFS_NODEVICE :
- (spare ? EZFS_ISSPARE : EZFS_ISL2CACHE);
+ if (err == 0) {
+ err = lzc_initialize(zhp->zpool_name, cmd_type,
+ vdev_guids, &errlist);
+ if (err == 0) {
fnvlist_free(vdev_guids);
fnvlist_free(guids_to_paths);
- return (zfs_error(hdl, err, msg));
+ return (0);
}
- uint64_t guid = fnvlist_lookup_uint64(tgt, ZPOOL_CONFIG_GUID);
- fnvlist_add_uint64(vdev_guids, vd_path, guid);
+ if (errlist != NULL) {
+ vd_errlist = fnvlist_lookup_nvlist(errlist,
+ ZPOOL_INITIALIZE_VDEVS);
+ }
- (void) snprintf(msg, sizeof (msg), "%llu", guid);
- fnvlist_add_string(guids_to_paths, msg, vd_path);
+ (void) snprintf(msg, sizeof (msg),
+ dgettext(TEXT_DOMAIN, "operation failed"));
+ } else {
+ verify(vd_errlist != NULL);
+ }
+
+ for (elem = nvlist_next_nvpair(vd_errlist, NULL); elem != NULL;
+ elem = nvlist_next_nvpair(vd_errlist, elem)) {
+ int64_t vd_error = xlate_init_err(fnvpair_value_int64(elem));
+ char *path;
+
+ if (nvlist_lookup_string(guids_to_paths, nvpair_name(elem),
+ &path) != 0)
+ path = nvpair_name(elem);
+
+ (void) zfs_error_fmt(zhp->zpool_hdl, vd_error,
+ "cannot initialize '%s'", path);
}
- int err = lzc_initialize(zhp->zpool_name, cmd_type, vdev_guids,
- &errlist);
fnvlist_free(vdev_guids);
+ fnvlist_free(guids_to_paths);
- if (err == 0) {
- fnvlist_free(guids_to_paths);
- return (0);
+ if (vd_errlist != NULL) {
+ fnvlist_free(vd_errlist);
+ return (-1);
}
+ return (zpool_standard_error(zhp->zpool_hdl, err, msg));
+}
+
+static int
+xlate_trim_err(int err)
+{
+ switch (err) {
+ case ENODEV:
+ return (EZFS_NODEVICE);
+ case EINVAL:
+ case EROFS:
+ return (EZFS_BADDEV);
+ case EBUSY:
+ return (EZFS_TRIMMING);
+ case ESRCH:
+ return (EZFS_NO_TRIM);
+ case EOPNOTSUPP:
+ return (EZFS_TRIM_NOTSUP);
+ }
+ return (err);
+}
+
+/*
+ * Begin, suspend, or cancel the TRIM (discarding of all free blocks) for
+ * the given vdevs in the given pool.
+ */
+int
+zpool_trim(zpool_handle_t *zhp, pool_trim_func_t cmd_type, nvlist_t *vds,
+ trimflags_t *trim_flags)
+{
+ char msg[1024];
+ int err;
+
+ nvlist_t *vdev_guids = fnvlist_alloc();
+ nvlist_t *guids_to_paths = fnvlist_alloc();
nvlist_t *vd_errlist = NULL;
- if (errlist != NULL) {
- vd_errlist = fnvlist_lookup_nvlist(errlist,
- ZPOOL_INITIALIZE_VDEVS);
+ nvlist_t *errlist;
+ nvpair_t *elem;
+
+ err = zpool_translate_vdev_guids(zhp, vds, vdev_guids,
+ guids_to_paths, &vd_errlist);
+ if (err == 0) {
+ err = lzc_trim(zhp->zpool_name, cmd_type, trim_flags->rate,
+ trim_flags->secure, vdev_guids, &errlist);
+ if (err == 0) {
+ fnvlist_free(vdev_guids);
+ fnvlist_free(guids_to_paths);
+ return (0);
+ }
+
+ if (errlist != NULL) {
+ vd_errlist = fnvlist_lookup_nvlist(errlist,
+ ZPOOL_TRIM_VDEVS);
+ }
+
+ (void) snprintf(msg, sizeof (msg),
+ dgettext(TEXT_DOMAIN, "operation failed"));
+ } else {
+ verify(vd_errlist != NULL);
}
- (void) snprintf(msg, sizeof (msg),
- dgettext(TEXT_DOMAIN, "operation failed"));
+ for (elem = nvlist_next_nvpair(vd_errlist, NULL);
+ elem != NULL; elem = nvlist_next_nvpair(vd_errlist, elem)) {
+ int64_t vd_error = xlate_trim_err(fnvpair_value_int64(elem));
+ char *path;
+ /*
+ * If only the pool was specified, and it was not a secure
+ * trim then suppress warnings for individual vdevs which
+ * do not support trimming.
+ */
+ if (vd_error == EZFS_TRIM_NOTSUP &&
+ trim_flags->fullpool &&
+ !trim_flags->secure) {
+ continue;
+ }
- for (elem = nvlist_next_nvpair(vd_errlist, NULL); elem != NULL;
- elem = nvlist_next_nvpair(vd_errlist, elem)) {
- int64_t vd_error = xlate_init_err(fnvpair_value_int64(elem));
- char *path = fnvlist_lookup_string(guids_to_paths,
- nvpair_name(elem));
- (void) zfs_error_fmt(hdl, vd_error, "cannot initialize '%s'",
- path);
+ if (nvlist_lookup_string(guids_to_paths, nvpair_name(elem),
+ &path) != 0)
+ path = nvpair_name(elem);
+
+ (void) zfs_error_fmt(zhp->zpool_hdl, vd_error,
+ "cannot trim '%s'", path);
}
+ fnvlist_free(vdev_guids);
fnvlist_free(guids_to_paths);
- if (vd_errlist != NULL)
+
+ if (vd_errlist != NULL) {
+ fnvlist_free(vd_errlist);
return (-1);
+ }
- return (zpool_standard_error(hdl, err, msg));
+ return (zpool_standard_error(zhp->zpool_hdl, err, msg));
}
/*
diff --git a/usr/src/lib/libzfs/common/libzfs_util.c b/usr/src/lib/libzfs/common/libzfs_util.c
index 47cea3d018..4d91e7b1ae 100644
--- a/usr/src/lib/libzfs/common/libzfs_util.c
+++ b/usr/src/lib/libzfs/common/libzfs_util.c
@@ -256,6 +256,8 @@ libzfs_error_description(libzfs_handle_t *hdl)
case EZFS_ACTIVE_POOL:
return (dgettext(TEXT_DOMAIN, "pool is imported on a "
"different host"));
+ case EZFS_CRYPTOFAILED:
+ return (dgettext(TEXT_DOMAIN, "encryption failure"));
case EZFS_TOOMANY:
return (dgettext(TEXT_DOMAIN, "argument list too long"));
case EZFS_INITIALIZING:
@@ -265,11 +267,16 @@ libzfs_error_description(libzfs_handle_t *hdl)
"initialization"));
case EZFS_WRONG_PARENT:
return (dgettext(TEXT_DOMAIN, "invalid parent dataset"));
+ case EZFS_TRIMMING:
+ return (dgettext(TEXT_DOMAIN, "currently trimming"));
+ case EZFS_NO_TRIM:
+ return (dgettext(TEXT_DOMAIN, "there is no active trim"));
+ case EZFS_TRIM_NOTSUP:
+ return (dgettext(TEXT_DOMAIN, "trim operations are not "
+ "supported by this device"));
case EZFS_NO_RESILVER_DEFER:
return (dgettext(TEXT_DOMAIN, "this action requires the "
"resilver_defer feature"));
- case EZFS_CRYPTOFAILED:
- return (dgettext(TEXT_DOMAIN, "encryption failure"));
case EZFS_UNKNOWN:
return (dgettext(TEXT_DOMAIN, "unknown error"));
default:
diff --git a/usr/src/lib/libzfs/common/mapfile-vers b/usr/src/lib/libzfs/common/mapfile-vers
index d98561d8ff..c402a25dd6 100644
--- a/usr/src/lib/libzfs/common/mapfile-vers
+++ b/usr/src/lib/libzfs/common/mapfile-vers
@@ -24,6 +24,7 @@
# Copyright (c) 2012, Joyent, Inc. All rights reserved.
# Copyright (c) 2011, 2017 by Delphix. All rights reserved.
# Copyright 2016 Nexenta Systems, Inc.
+# Copyright 2019 Joyent, Inc.
#
#
@@ -254,6 +255,7 @@ SYMBOL_VERSION SUNWprivate_1.1 {
zpool_skip_pool;
zpool_state_to_name;
zpool_sync_one;
+ zpool_trim;
zpool_tryimport;
zpool_unmount_datasets;
zpool_upgrade;
diff --git a/usr/src/lib/libzfs_core/common/libzfs_core.c b/usr/src/lib/libzfs_core/common/libzfs_core.c
index ac8ec6d11a..aad4104fa5 100644
--- a/usr/src/lib/libzfs_core/common/libzfs_core.c
+++ b/usr/src/lib/libzfs_core/common/libzfs_core.c
@@ -1176,7 +1176,8 @@ lzc_channel_program_nosync(const char *pool, const char *program,
* - ENODEV if the device was not found
* - EINVAL if the devices is not a leaf or is not concrete (e.g. missing)
* - EROFS if the device is not writeable
- * - EBUSY start requested but the device is already being initialized
+ * - EBUSY start requested but the device is already being either
+ * initialized or trimmed
* - ESRCH cancel/suspend requested but device is not being initialized
*
* If the errlist is empty, then return value will be:
@@ -1189,6 +1190,7 @@ lzc_initialize(const char *poolname, pool_initialize_func_t cmd_type,
nvlist_t *vdevs, nvlist_t **errlist)
{
int error;
+
nvlist_t *args = fnvlist_alloc();
fnvlist_add_uint64(args, ZPOOL_INITIALIZE_COMMAND, (uint64_t)cmd_type);
fnvlist_add_nvlist(args, ZPOOL_INITIALIZE_VDEVS, vdevs);
@@ -1201,6 +1203,48 @@ lzc_initialize(const char *poolname, pool_initialize_func_t cmd_type,
}
/*
+ * Changes TRIM state.
+ *
+ * vdevs should be a list of (<key>, guid) where guid is a uint64 vdev GUID.
+ * The key is ignored.
+ *
+ * If there are errors related to vdev arguments, per-vdev errors are returned
+ * in an nvlist with the key "vdevs". Each error is a (guid, errno) pair where
+ * guid is stringified with PRIu64, and errno is one of the following as
+ * an int64_t:
+ * - ENODEV if the device was not found
+ * - EINVAL if the devices is not a leaf or is not concrete (e.g. missing)
+ * - EROFS if the device is not writeable
+ * - EBUSY start requested but the device is already being either trimmed
+ * or initialized
+ * - ESRCH cancel/suspend requested but device is not being initialized
+ * - EOPNOTSUPP if the device does not support TRIM (or secure TRIM)
+ *
+ * If the errlist is empty, then return value will be:
+ * - EINVAL if one or more arguments was invalid
+ * - Other spa_open failures
+ * - 0 if the operation succeeded
+ */
+int
+lzc_trim(const char *poolname, pool_trim_func_t cmd_type, uint64_t rate,
+ boolean_t secure, nvlist_t *vdevs, nvlist_t **errlist)
+{
+ int error;
+
+ nvlist_t *args = fnvlist_alloc();
+ fnvlist_add_uint64(args, ZPOOL_TRIM_COMMAND, (uint64_t)cmd_type);
+ fnvlist_add_nvlist(args, ZPOOL_TRIM_VDEVS, vdevs);
+ fnvlist_add_uint64(args, ZPOOL_TRIM_RATE, rate);
+ fnvlist_add_boolean_value(args, ZPOOL_TRIM_SECURE, secure);
+
+ error = lzc_ioctl(ZFS_IOC_POOL_TRIM, poolname, args, errlist);
+
+ fnvlist_free(args);
+
+ return (error);
+}
+
+/*
* Performs key management functions
*
* crypto_cmd should be a value from zfs_ioc_crypto_cmd_t. If the command
diff --git a/usr/src/lib/libzfs_core/common/libzfs_core.h b/usr/src/lib/libzfs_core/common/libzfs_core.h
index e1574feff6..9b7721e7eb 100644
--- a/usr/src/lib/libzfs_core/common/libzfs_core.h
+++ b/usr/src/lib/libzfs_core/common/libzfs_core.h
@@ -62,6 +62,9 @@ int lzc_get_bookmarks(const char *, nvlist_t *, nvlist_t **);
int lzc_destroy_bookmarks(nvlist_t *, nvlist_t **);
int lzc_initialize(const char *, pool_initialize_func_t, nvlist_t *,
nvlist_t **);
+int lzc_trim(const char *, pool_trim_func_t, uint64_t, boolean_t,
+ nvlist_t *, nvlist_t **);
+
int lzc_load_key(const char *, boolean_t, uint8_t *, uint_t);
int lzc_unload_key(const char *);
int lzc_change_key(const char *, uint64_t, nvlist_t *, uint8_t *, uint_t);
diff --git a/usr/src/lib/libzfs_core/common/mapfile-vers b/usr/src/lib/libzfs_core/common/mapfile-vers
index 5bcb42c726..98516b66cc 100644
--- a/usr/src/lib/libzfs_core/common/mapfile-vers
+++ b/usr/src/lib/libzfs_core/common/mapfile-vers
@@ -38,6 +38,12 @@
$mapfile_version 2
+SYMBOL_VERSION ILLUMOS_0.7 {
+ global:
+
+ lzc_trim;
+} ILLUMOS_0.6;
+
SYMBOL_VERSION ILLUMOS_0.6 {
global:
diff --git a/usr/src/lib/libzpool/common/sys/zfs_context.h b/usr/src/lib/libzpool/common/sys/zfs_context.h
index 232530519f..5532a81f64 100644
--- a/usr/src/lib/libzpool/common/sys/zfs_context.h
+++ b/usr/src/lib/libzpool/common/sys/zfs_context.h
@@ -21,8 +21,8 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
- * Copyright (c) 2017, Joyent, Inc.
* Copyright (c) 2012, 2016 by Delphix. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
* Copyright 2017 RackTop Systems.
*/
@@ -252,6 +252,7 @@ extern int fop_getattr(vnode_t *vp, vattr_t *vap);
#define VOP_CLOSE(vp, f, c, o, cr, ct) 0
#define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) 0
#define VOP_GETATTR(vp, vap, fl, cr, ct) fop_getattr((vp), (vap));
+#define VOP_SPACE(vp, cmd, a, f, o, cr, ct) 0
#define VOP_FSYNC(vp, f, cr, ct) fsync((vp)->v_fd)