aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/openzfs/module
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/openzfs/module')
-rw-r--r--sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c19
-rw-r--r--sys/contrib/openzfs/module/zcommon/zfeature_common.c13
-rw-r--r--sys/contrib/openzfs/module/zcommon/zpool_prop.c4
-rw-r--r--sys/contrib/openzfs/module/zfs/spa.c30
-rw-r--r--sys/contrib/openzfs/module/zfs/spa_config.c4
5 files changed, 46 insertions, 24 deletions
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c
index ab82b2aaeb78..ff4d80ef1dfd 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/abd_os.c
@@ -328,25 +328,6 @@ abd_alloc_for_io(size_t size, boolean_t is_metadata)
return (abd_alloc_linear(size, is_metadata));
}
-/*
- * This is just a helper function to abd_get_offset_scatter() to alloc a
- * scatter ABD using the calculated chunkcnt based on the offset within the
- * parent ABD.
- */
-static abd_t *
-abd_alloc_scatter_offset_chunkcnt(size_t chunkcnt)
-{
- size_t abd_size = offsetof(abd_t,
- abd_u.abd_scatter.abd_chunks[chunkcnt]);
- abd_t *abd = kmem_alloc(abd_size, KM_PUSHPAGE);
- ASSERT3P(abd, !=, NULL);
- list_link_init(&abd->abd_gang_link);
- mutex_init(&abd->abd_mtx, NULL, MUTEX_DEFAULT, NULL);
- ABDSTAT_INCR(abdstat_struct_size, abd_size);
-
- return (abd);
-}
-
abd_t *
abd_get_offset_scatter(abd_t *abd, abd_t *sabd, size_t off)
{
diff --git a/sys/contrib/openzfs/module/zcommon/zfeature_common.c b/sys/contrib/openzfs/module/zcommon/zfeature_common.c
index 34ebabcf3b3c..e95a85e89ba2 100644
--- a/sys/contrib/openzfs/module/zcommon/zfeature_common.c
+++ b/sys/contrib/openzfs/module/zcommon/zfeature_common.c
@@ -222,9 +222,15 @@ zfs_mod_supported_feature(const char *name)
* features are supported.
*
* The equivalent _can_ be done on FreeBSD by way of the sysctl
- * tree, but this has not been done yet.
+ * tree, but this has not been done yet. Therefore, we return
+ * that all features except edonr are supported.
*/
-#if defined(_KERNEL) || defined(LIB_ZPOOL_BUILD) || defined(__FreeBSD__)
+#if defined(__FreeBSD__)
+ if (strcmp(name, "org.illumos:edonr") == 0)
+ return (B_FALSE);
+ else
+ return (B_TRUE);
+#elif defined(_KERNEL) || defined(LIB_ZPOOL_BUILD)
return (B_TRUE);
#else
return (zfs_mod_supported(ZFS_SYSFS_POOL_FEATURES, name));
@@ -440,8 +446,6 @@ zpool_feature_init(void)
skein_deps);
}
-#if !defined(__FreeBSD__)
-
{
static const spa_feature_t edonr_deps[] = {
SPA_FEATURE_EXTENSIBLE_DATASET,
@@ -453,7 +457,6 @@ zpool_feature_init(void)
ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN,
edonr_deps);
}
-#endif
{
static const spa_feature_t redact_books_deps[] = {
diff --git a/sys/contrib/openzfs/module/zcommon/zpool_prop.c b/sys/contrib/openzfs/module/zcommon/zpool_prop.c
index 815fad6df0e0..6299d371f25d 100644
--- a/sys/contrib/openzfs/module/zcommon/zpool_prop.c
+++ b/sys/contrib/openzfs/module/zcommon/zpool_prop.c
@@ -22,6 +22,7 @@
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
+ * Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
*/
#include <sys/zio.h>
@@ -71,6 +72,9 @@ zpool_prop_init(void)
PROP_DEFAULT, ZFS_TYPE_POOL, "<file> | none", "CACHEFILE");
zprop_register_string(ZPOOL_PROP_COMMENT, "comment", NULL,
PROP_DEFAULT, ZFS_TYPE_POOL, "<comment-string>", "COMMENT");
+ zprop_register_string(ZPOOL_PROP_COMPATIBILITY, "compatibility",
+ "off", PROP_DEFAULT, ZFS_TYPE_POOL,
+ "<file[,file...]> | off | legacy", "COMPATIBILITY");
/* readonly number properties */
zprop_register_number(ZPOOL_PROP_SIZE, "size", 0, PROP_READONLY,
diff --git a/sys/contrib/openzfs/module/zfs/spa.c b/sys/contrib/openzfs/module/zfs/spa.c
index 56354a107e66..5170c9ca226f 100644
--- a/sys/contrib/openzfs/module/zfs/spa.c
+++ b/sys/contrib/openzfs/module/zfs/spa.c
@@ -32,6 +32,7 @@
* Copyright (c) 2017, 2019, Datto Inc. All rights reserved.
* Copyright 2017 Joyent, Inc.
* Copyright (c) 2017, Intel Corporation.
+ * Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
*/
/*
@@ -377,6 +378,11 @@ spa_prop_get_config(spa_t *spa, nvlist_t **nvp)
0, ZPROP_SRC_LOCAL);
}
+ if (spa->spa_compatibility != NULL) {
+ spa_prop_add_list(*nvp, ZPOOL_PROP_COMPATIBILITY,
+ spa->spa_compatibility, 0, ZPROP_SRC_LOCAL);
+ }
+
if (spa->spa_root != NULL)
spa_prop_add_list(*nvp, ZPOOL_PROP_ALTROOT, spa->spa_root,
0, ZPROP_SRC_LOCAL);
@@ -1669,6 +1675,10 @@ spa_unload(spa_t *spa)
spa_strfree(spa->spa_comment);
spa->spa_comment = NULL;
}
+ if (spa->spa_compatibility != NULL) {
+ spa_strfree(spa->spa_compatibility);
+ spa->spa_compatibility = NULL;
+ }
spa_config_exit(spa, SCL_ALL, spa);
}
@@ -3249,6 +3259,7 @@ spa_ld_parse_config(spa_t *spa, spa_import_type_t type)
vdev_t *rvd;
uint64_t pool_guid;
char *comment;
+ char *compatibility;
/*
* Versioning wasn't explicitly added to the label until later, so if
@@ -3297,6 +3308,11 @@ spa_ld_parse_config(spa_t *spa, spa_import_type_t type)
if (nvlist_lookup_string(config, ZPOOL_CONFIG_COMMENT, &comment) == 0)
spa->spa_comment = spa_strdup(comment);
+ ASSERT(spa->spa_compatibility == NULL);
+ if (nvlist_lookup_string(config, ZPOOL_CONFIG_COMPATIBILITY,
+ &compatibility) == 0)
+ spa->spa_compatibility = spa_strdup(compatibility);
+
(void) nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_TXG,
&spa->spa_config_txg);
@@ -8668,6 +8684,20 @@ spa_sync_props(void *arg, dmu_tx_t *tx)
spa_history_log_internal(spa, "set", tx,
"%s=%s", nvpair_name(elem), strval);
break;
+ case ZPOOL_PROP_COMPATIBILITY:
+ strval = fnvpair_value_string(elem);
+ if (spa->spa_compatibility != NULL)
+ spa_strfree(spa->spa_compatibility);
+ spa->spa_compatibility = spa_strdup(strval);
+ /*
+ * Dirty the configuration on vdevs as above.
+ */
+ if (tx->tx_txg != TXG_INITIAL)
+ vdev_config_dirty(spa->spa_root_vdev);
+ spa_history_log_internal(spa, "set", tx,
+ "%s=%s", nvpair_name(elem), strval);
+ break;
+
default:
/*
* Set pool property values in the poolprops mos object.
diff --git a/sys/contrib/openzfs/module/zfs/spa_config.c b/sys/contrib/openzfs/module/zfs/spa_config.c
index dacba127dcfa..4a3144313267 100644
--- a/sys/contrib/openzfs/module/zfs/spa_config.c
+++ b/sys/contrib/openzfs/module/zfs/spa_config.c
@@ -24,6 +24,7 @@
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011, 2020 by Delphix. All rights reserved.
* Copyright 2017 Joyent, Inc.
+ * Copyright (c) 2021, Colm Buckley <colm@tuatha.org>
*/
#include <sys/spa.h>
@@ -446,6 +447,9 @@ spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t txg, int getstats)
if (spa->spa_comment != NULL)
fnvlist_add_string(config, ZPOOL_CONFIG_COMMENT,
spa->spa_comment);
+ if (spa->spa_compatibility != NULL)
+ fnvlist_add_string(config, ZPOOL_CONFIG_COMPATIBILITY,
+ spa->spa_compatibility);
hostid = spa_get_hostid(spa);
if (hostid != 0)