From 35ec51796f0aa8d4fe322b48e7d1d5a65e38a4ce Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 17 Feb 2021 08:14:51 -0800 Subject: [PATCH] FreeBSD: disable edonr in zfs_mod_supported_feature() Rather than conditionally compiling out the edonr code for FreeBSD update zfs_mod_supported_feature() to indicate this feature is unsupported. This ensures that all spa features are defined on every platform, even if they are not supported. Reviewed-by: Ryan Moeller Signed-off-by: Brian Behlendorf Closes #11605 Issue #11468 --- cmd/zpool/zpool_main.c | 8 ++++++++ include/zfeature_common.h | 2 -- module/zcommon/zfeature_common.c | 13 ++++++++----- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 50adc0add605..eef12d97f339 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -8629,6 +8629,10 @@ upgrade_enable_all(zpool_handle_t *zhp, int *countp) for (i = 0; i < SPA_FEATURES; i++) { const char *fname = spa_feature_table[i].fi_uname; const char *fguid = spa_feature_table[i].fi_guid; + + if (!spa_feature_table[i].fi_zfs_mod_supported) + continue; + if (!nvlist_exists(enabled, fguid)) { char *propname; verify(-1 != asprintf(&propname, "feature@%s", fname)); @@ -8759,6 +8763,10 @@ upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg) for (i = 0; i < SPA_FEATURES; i++) { const char *fguid = spa_feature_table[i].fi_guid; const char *fname = spa_feature_table[i].fi_uname; + + if (!spa_feature_table[i].fi_zfs_mod_supported) + continue; + if (!nvlist_exists(enabled, fguid)) { if (cbp->cb_first) { (void) printf(gettext("\nSome " diff --git a/include/zfeature_common.h b/include/zfeature_common.h index cf05bad76c3c..76dd7ed57478 100644 --- a/include/zfeature_common.h +++ b/include/zfeature_common.h @@ -56,9 +56,7 @@ typedef enum spa_feature { SPA_FEATURE_LARGE_DNODE, SPA_FEATURE_SHA512, SPA_FEATURE_SKEIN, -#if !defined(__FreeBSD__) SPA_FEATURE_EDONR, -#endif SPA_FEATURE_USEROBJ_ACCOUNTING, SPA_FEATURE_ENCRYPTION, SPA_FEATURE_PROJECT_QUOTA, diff --git a/module/zcommon/zfeature_common.c b/module/zcommon/zfeature_common.c index 34ebabcf3b3c..e95a85e89ba2 100644 --- a/module/zcommon/zfeature_common.c +++ b/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[] = {