Path: blob/main/sys/contrib/openzfs/module/zcommon/zfeature_common.c
48383 views
// SPDX-License-Identifier: CDDL-1.01/*2* CDDL HEADER START3*4* The contents of this file are subject to the terms of the5* Common Development and Distribution License (the "License").6* You may not use this file except in compliance with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or https://opensource.org/licenses/CDDL-1.0.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/2122/*23* Copyright (c) 2011, 2018 by Delphix. All rights reserved.24* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.25* Copyright (c) 2013, Joyent, Inc. All rights reserved.26* Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved.27* Copyright (c) 2017, Intel Corporation.28* Copyright (c) 2019, 2024, Klara, Inc.29* Copyright (c) 2019, Allan Jude30*/3132#ifndef _KERNEL33#include <errno.h>34#include <string.h>35#include <dirent.h>36#include <search.h>37#include <sys/stat.h>38#endif39#include <sys/debug.h>40#include <sys/fs/zfs.h>41#include <sys/inttypes.h>42#include <sys/types.h>43#include <sys/param.h>44#include <sys/zfs_sysfs.h>45#include "zfeature_common.h"4647/*48* Set to disable all feature checks while opening pools, allowing pools with49* unsupported features to be opened. Set for testing only.50*/51boolean_t zfeature_checks_disable = B_FALSE;5253zfeature_info_t spa_feature_table[SPA_FEATURES];5455/*56* Valid characters for feature guids. This list is mainly for aesthetic57* purposes and could be expanded in the future. There are different allowed58* characters in the guids reverse dns portion (before the colon) and its59* short name (after the colon).60*/61static int62valid_char(char c, boolean_t after_colon)63{64return ((c >= 'a' && c <= 'z') ||65(c >= '0' && c <= '9') ||66(after_colon && c == '_') ||67(!after_colon && (c == '.' || c == '-')));68}6970/*71* Every feature guid must contain exactly one colon which separates a reverse72* dns organization name from the feature's "short" name (e.g.73* "com.company:feature_name").74*/75boolean_t76zfeature_is_valid_guid(const char *name)77{78int i;79boolean_t has_colon = B_FALSE;8081i = 0;82while (name[i] != '\0') {83char c = name[i++];84if (c == ':') {85if (has_colon)86return (B_FALSE);87has_colon = B_TRUE;88continue;89}90if (!valid_char(c, has_colon))91return (B_FALSE);92}9394return (has_colon);95}9697boolean_t98zfeature_is_supported(const char *guid)99{100if (zfeature_checks_disable)101return (B_TRUE);102103for (spa_feature_t i = 0; i < SPA_FEATURES; i++) {104zfeature_info_t *feature = &spa_feature_table[i];105if (!feature->fi_zfs_mod_supported)106continue;107if (strcmp(guid, feature->fi_guid) == 0)108return (B_TRUE);109}110return (B_FALSE);111}112113int114zfeature_lookup_guid(const char *guid, spa_feature_t *res)115{116for (spa_feature_t i = 0; i < SPA_FEATURES; i++) {117zfeature_info_t *feature = &spa_feature_table[i];118if (!feature->fi_zfs_mod_supported)119continue;120if (strcmp(guid, feature->fi_guid) == 0) {121if (res != NULL)122*res = i;123return (0);124}125}126127return (ENOENT);128}129130int131zfeature_lookup_name(const char *name, spa_feature_t *res)132{133for (spa_feature_t i = 0; i < SPA_FEATURES; i++) {134zfeature_info_t *feature = &spa_feature_table[i];135if (!feature->fi_zfs_mod_supported)136continue;137if (strcmp(name, feature->fi_uname) == 0) {138if (res != NULL)139*res = i;140return (0);141}142}143144return (ENOENT);145}146147boolean_t148zfeature_depends_on(spa_feature_t fid, spa_feature_t check)149{150zfeature_info_t *feature = &spa_feature_table[fid];151152for (int i = 0; feature->fi_depends[i] != SPA_FEATURE_NONE; i++) {153if (feature->fi_depends[i] == check)154return (B_TRUE);155}156return (B_FALSE);157}158159static boolean_t160deps_contains_feature(const spa_feature_t *deps, const spa_feature_t feature)161{162for (int i = 0; deps[i] != SPA_FEATURE_NONE; i++)163if (deps[i] == feature)164return (B_TRUE);165166return (B_FALSE);167}168169#define STRCMP ((int(*)(const void *, const void *))&strcmp)170struct zfs_mod_supported_features {171void *tree;172boolean_t all_features;173};174175struct zfs_mod_supported_features *176zfs_mod_list_supported(const char *scope)177{178#if defined(__FreeBSD__) || defined(_KERNEL) || defined(LIB_ZPOOL_BUILD)179(void) scope;180return (NULL);181#else182struct zfs_mod_supported_features *ret = calloc(1, sizeof (*ret));183if (ret == NULL)184return (NULL);185186DIR *sysfs_dir = NULL;187char path[128];188189if (snprintf(path, sizeof (path), "%s/%s",190ZFS_SYSFS_DIR, scope) < sizeof (path))191sysfs_dir = opendir(path);192if (sysfs_dir == NULL && errno == ENOENT) {193if (snprintf(path, sizeof (path), "%s/%s",194ZFS_SYSFS_ALT_DIR, scope) < sizeof (path))195sysfs_dir = opendir(path);196}197if (sysfs_dir == NULL) {198ret->all_features = errno == ENOENT &&199(access(ZFS_SYSFS_DIR, F_OK) == 0 ||200access(ZFS_SYSFS_ALT_DIR, F_OK) == 0);201return (ret);202}203204struct dirent *node;205while ((node = readdir(sysfs_dir)) != NULL) {206if (strcmp(node->d_name, ".") == 0 ||207strcmp(node->d_name, "..") == 0)208continue;209210char *name = strdup(node->d_name);211if (name == NULL) {212goto nomem;213}214215if (tsearch(name, &ret->tree, STRCMP) == NULL) {216/*217* Don't bother checking for duplicate entries:218* we're iterating a single directory.219*/220free(name);221goto nomem;222}223}224225end:226closedir(sysfs_dir);227return (ret);228229nomem:230zfs_mod_list_supported_free(ret);231ret = NULL;232goto end;233#endif234}235236void237zfs_mod_list_supported_free(struct zfs_mod_supported_features *list)238{239#if !defined(__FreeBSD__) && !defined(_KERNEL) && !defined(LIB_ZPOOL_BUILD)240if (list) {241tdestroy(list->tree, free);242free(list);243}244#else245(void) list;246#endif247}248249#if !defined(_KERNEL) && !defined(LIB_ZPOOL_BUILD)250static boolean_t251zfs_mod_supported_impl(const char *scope, const char *name, const char *sysfs)252{253char path[128];254if (snprintf(path, sizeof (path), "%s%s%s%s%s", sysfs,255scope == NULL ? "" : "/", scope ?: "",256name == NULL ? "" : "/", name ?: "") < sizeof (path))257return (access(path, F_OK) == 0);258else259return (B_FALSE);260}261262boolean_t263zfs_mod_supported(const char *scope, const char *name,264const struct zfs_mod_supported_features *sfeatures)265{266boolean_t supported;267268if (sfeatures != NULL)269return (sfeatures->all_features ||270tfind(name, &sfeatures->tree, STRCMP));271272/*273* Check both the primary and alternate sysfs locations to determine274* if the required functionality is supported.275*/276supported = (zfs_mod_supported_impl(scope, name, ZFS_SYSFS_DIR) ||277zfs_mod_supported_impl(scope, name, ZFS_SYSFS_ALT_DIR));278279/*280* For backwards compatibility with kernel modules that predate281* supported feature/property checking. Report the feature/property282* as supported if the kernel module is loaded but the requested283* scope directory does not exist.284*/285if (supported == B_FALSE) {286if ((access(ZFS_SYSFS_DIR, F_OK) == 0 &&287!zfs_mod_supported_impl(scope, NULL, ZFS_SYSFS_DIR)) ||288(access(ZFS_SYSFS_ALT_DIR, F_OK) == 0 &&289!zfs_mod_supported_impl(scope, NULL, ZFS_SYSFS_ALT_DIR))) {290supported = B_TRUE;291}292}293294return (supported);295}296#endif297298static boolean_t299zfs_mod_supported_feature(const char *name,300const struct zfs_mod_supported_features *sfeatures)301{302/*303* The zfs module spa_feature_table[], whether in-kernel or in304* libzpool, always supports all the features. libzfs needs to305* query the running module, via sysfs, to determine which306* features are supported.307*308* The equivalent _can_ be done on FreeBSD by way of the sysctl309* tree, but this has not been done yet. Therefore, we return310* that all features are supported.311*/312313#if defined(_KERNEL) || defined(LIB_ZPOOL_BUILD) || defined(__FreeBSD__)314(void) name, (void) sfeatures;315return (B_TRUE);316#else317return (zfs_mod_supported(ZFS_SYSFS_POOL_FEATURES, name, sfeatures));318#endif319}320321static void322zfeature_register(spa_feature_t fid, const char *guid, const char *name,323const char *desc, zfeature_flags_t flags, zfeature_type_t type,324const spa_feature_t *deps,325const struct zfs_mod_supported_features *sfeatures)326{327zfeature_info_t *feature = &spa_feature_table[fid];328static const spa_feature_t nodeps[] = { SPA_FEATURE_NONE };329330ASSERT(name != NULL);331ASSERT(desc != NULL);332ASSERT((flags & ZFEATURE_FLAG_READONLY_COMPAT) == 0 ||333(flags & ZFEATURE_FLAG_MOS) == 0);334ASSERT3U(fid, <, SPA_FEATURES);335ASSERT(zfeature_is_valid_guid(guid));336337if (deps == NULL)338deps = nodeps;339340VERIFY(((flags & ZFEATURE_FLAG_PER_DATASET) == 0) ||341(deps_contains_feature(deps, SPA_FEATURE_EXTENSIBLE_DATASET)));342343feature->fi_feature = fid;344feature->fi_guid = guid;345feature->fi_uname = name;346feature->fi_desc = desc;347feature->fi_flags = flags;348feature->fi_type = type;349feature->fi_depends = deps;350feature->fi_zfs_mod_supported =351zfs_mod_supported_feature(guid, sfeatures);352}353354/*355* Every feature has a GUID of the form com.example:feature_name. The356* reversed DNS name ensures that the feature's GUID is unique across all ZFS357* implementations. This allows companies to independently develop and358* release features. Examples include org.delphix and org.datto. Previously,359* features developed on one implementation have used that implementation's360* domain name (e.g. org.illumos and org.zfsonlinux). Use of the org.openzfs361* domain name is recommended for new features which are developed by the362* OpenZFS community and its platforms. This domain may optionally be used by363* companies developing features for initial release through an OpenZFS364* implementation. Use of the org.openzfs domain requires reserving the365* feature name in advance with the OpenZFS project.366*/367void368zpool_feature_init(void)369{370struct zfs_mod_supported_features *sfeatures =371zfs_mod_list_supported(ZFS_SYSFS_POOL_FEATURES);372373zfeature_register(SPA_FEATURE_ASYNC_DESTROY,374"com.delphix:async_destroy", "async_destroy",375"Destroy filesystems asynchronously.",376ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,377sfeatures);378379zfeature_register(SPA_FEATURE_EMPTY_BPOBJ,380"com.delphix:empty_bpobj", "empty_bpobj",381"Snapshots use less space.",382ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,383sfeatures);384385zfeature_register(SPA_FEATURE_LZ4_COMPRESS,386"org.illumos:lz4_compress", "lz4_compress",387"LZ4 compression algorithm support.",388ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, ZFEATURE_TYPE_BOOLEAN, NULL,389sfeatures);390391zfeature_register(SPA_FEATURE_MULTI_VDEV_CRASH_DUMP,392"com.joyent:multi_vdev_crash_dump", "multi_vdev_crash_dump",393"Crash dumps to multiple vdev pools.",3940, ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);395396zfeature_register(SPA_FEATURE_SPACEMAP_HISTOGRAM,397"com.delphix:spacemap_histogram", "spacemap_histogram",398"Spacemaps maintain space histograms.",399ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,400sfeatures);401402zfeature_register(SPA_FEATURE_ENABLED_TXG,403"com.delphix:enabled_txg", "enabled_txg",404"Record txg at which a feature is enabled",405ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,406sfeatures);407408{409static const spa_feature_t hole_birth_deps[] = {410SPA_FEATURE_ENABLED_TXG,411SPA_FEATURE_NONE412};413zfeature_register(SPA_FEATURE_HOLE_BIRTH,414"com.delphix:hole_birth", "hole_birth",415"Retain hole birth txg for more precise zfs send",416ZFEATURE_FLAG_MOS | ZFEATURE_FLAG_ACTIVATE_ON_ENABLE,417ZFEATURE_TYPE_BOOLEAN, hole_birth_deps, sfeatures);418}419420zfeature_register(SPA_FEATURE_POOL_CHECKPOINT,421"com.delphix:zpool_checkpoint", "zpool_checkpoint",422"Pool state can be checkpointed, allowing rewind later.",423ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,424sfeatures);425426zfeature_register(SPA_FEATURE_SPACEMAP_V2,427"com.delphix:spacemap_v2", "spacemap_v2",428"Space maps representing large segments are more efficient.",429ZFEATURE_FLAG_READONLY_COMPAT | ZFEATURE_FLAG_ACTIVATE_ON_ENABLE,430ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);431432zfeature_register(SPA_FEATURE_EXTENSIBLE_DATASET,433"com.delphix:extensible_dataset", "extensible_dataset",434"Enhanced dataset functionality, used by other features.",4350, ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);436437{438static const spa_feature_t bookmarks_deps[] = {439SPA_FEATURE_EXTENSIBLE_DATASET,440SPA_FEATURE_NONE441};442443zfeature_register(SPA_FEATURE_BOOKMARKS,444"com.delphix:bookmarks", "bookmarks",445"\"zfs bookmark\" command",446ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN,447bookmarks_deps, sfeatures);448}449450{451static const spa_feature_t filesystem_limits_deps[] = {452SPA_FEATURE_EXTENSIBLE_DATASET,453SPA_FEATURE_NONE454};455zfeature_register(SPA_FEATURE_FS_SS_LIMIT,456"com.joyent:filesystem_limits", "filesystem_limits",457"Filesystem and snapshot limits.",458ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN,459filesystem_limits_deps, sfeatures);460}461462zfeature_register(SPA_FEATURE_EMBEDDED_DATA,463"com.delphix:embedded_data", "embedded_data",464"Blocks which compress very well use even less space.",465ZFEATURE_FLAG_MOS | ZFEATURE_FLAG_ACTIVATE_ON_ENABLE,466ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);467468{469static const spa_feature_t livelist_deps[] = {470SPA_FEATURE_EXTENSIBLE_DATASET,471SPA_FEATURE_NONE472};473zfeature_register(SPA_FEATURE_LIVELIST,474"com.delphix:livelist", "livelist",475"Improved clone deletion performance.",476ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN,477livelist_deps, sfeatures);478}479480{481static const spa_feature_t log_spacemap_deps[] = {482SPA_FEATURE_SPACEMAP_V2,483SPA_FEATURE_NONE484};485zfeature_register(SPA_FEATURE_LOG_SPACEMAP,486"com.delphix:log_spacemap", "log_spacemap",487"Log metaslab changes on a single spacemap and "488"flush them periodically.",489ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN,490log_spacemap_deps, sfeatures);491}492493{494static const spa_feature_t large_blocks_deps[] = {495SPA_FEATURE_EXTENSIBLE_DATASET,496SPA_FEATURE_NONE497};498zfeature_register(SPA_FEATURE_LARGE_BLOCKS,499"org.open-zfs:large_blocks", "large_blocks",500"Support for blocks larger than 128KB.",501ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN,502large_blocks_deps, sfeatures);503}504505{506static const spa_feature_t large_dnode_deps[] = {507SPA_FEATURE_EXTENSIBLE_DATASET,508SPA_FEATURE_NONE509};510zfeature_register(SPA_FEATURE_LARGE_DNODE,511"org.zfsonlinux:large_dnode", "large_dnode",512"Variable on-disk size of dnodes.",513ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN,514large_dnode_deps, sfeatures);515}516517{518static const spa_feature_t sha512_deps[] = {519SPA_FEATURE_EXTENSIBLE_DATASET,520SPA_FEATURE_NONE521};522zfeature_register(SPA_FEATURE_SHA512,523"org.illumos:sha512", "sha512",524"SHA-512/256 hash algorithm.",525ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN,526sha512_deps, sfeatures);527}528529{530static const spa_feature_t skein_deps[] = {531SPA_FEATURE_EXTENSIBLE_DATASET,532SPA_FEATURE_NONE533};534zfeature_register(SPA_FEATURE_SKEIN,535"org.illumos:skein", "skein",536"Skein hash algorithm.",537ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN,538skein_deps, sfeatures);539}540541{542static const spa_feature_t edonr_deps[] = {543SPA_FEATURE_EXTENSIBLE_DATASET,544SPA_FEATURE_NONE545};546zfeature_register(SPA_FEATURE_EDONR,547"org.illumos:edonr", "edonr",548"Edon-R hash algorithm.",549ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN,550edonr_deps, sfeatures);551}552553{554static const spa_feature_t redact_books_deps[] = {555SPA_FEATURE_BOOKMARK_V2,556SPA_FEATURE_EXTENSIBLE_DATASET,557SPA_FEATURE_BOOKMARKS,558SPA_FEATURE_NONE559};560zfeature_register(SPA_FEATURE_REDACTION_BOOKMARKS,561"com.delphix:redaction_bookmarks", "redaction_bookmarks",562"Support for bookmarks which store redaction lists for zfs "563"redacted send/recv.", 0, ZFEATURE_TYPE_BOOLEAN,564redact_books_deps, sfeatures);565}566567{568static const spa_feature_t redact_datasets_deps[] = {569SPA_FEATURE_EXTENSIBLE_DATASET,570SPA_FEATURE_NONE571};572zfeature_register(SPA_FEATURE_REDACTED_DATASETS,573"com.delphix:redacted_datasets", "redacted_datasets",574"Support for redacted datasets, produced by receiving "575"a redacted zfs send stream.",576ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_UINT64_ARRAY,577redact_datasets_deps, sfeatures);578}579580{581static const spa_feature_t bookmark_written_deps[] = {582SPA_FEATURE_BOOKMARK_V2,583SPA_FEATURE_EXTENSIBLE_DATASET,584SPA_FEATURE_BOOKMARKS,585SPA_FEATURE_NONE586};587zfeature_register(SPA_FEATURE_BOOKMARK_WRITTEN,588"com.delphix:bookmark_written", "bookmark_written",589"Additional accounting, enabling the written#<bookmark> "590"property (space written since a bookmark), "591"and estimates of send stream sizes for incrementals from "592"bookmarks.",5930, ZFEATURE_TYPE_BOOLEAN, bookmark_written_deps, sfeatures);594}595596zfeature_register(SPA_FEATURE_DEVICE_REMOVAL,597"com.delphix:device_removal", "device_removal",598"Top-level vdevs can be removed, reducing logical pool size.",599ZFEATURE_FLAG_MOS, ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);600601{602static const spa_feature_t obsolete_counts_deps[] = {603SPA_FEATURE_EXTENSIBLE_DATASET,604SPA_FEATURE_DEVICE_REMOVAL,605SPA_FEATURE_NONE606};607zfeature_register(SPA_FEATURE_OBSOLETE_COUNTS,608"com.delphix:obsolete_counts", "obsolete_counts",609"Reduce memory used by removed devices when their blocks "610"are freed or remapped.",611ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN,612obsolete_counts_deps, sfeatures);613}614615{616static const spa_feature_t userobj_accounting_deps[] = {617SPA_FEATURE_EXTENSIBLE_DATASET,618SPA_FEATURE_NONE619};620zfeature_register(SPA_FEATURE_USEROBJ_ACCOUNTING,621"org.zfsonlinux:userobj_accounting", "userobj_accounting",622"User/Group object accounting.",623ZFEATURE_FLAG_READONLY_COMPAT | ZFEATURE_FLAG_PER_DATASET,624ZFEATURE_TYPE_BOOLEAN, userobj_accounting_deps, sfeatures);625}626627{628static const spa_feature_t bookmark_v2_deps[] = {629SPA_FEATURE_EXTENSIBLE_DATASET,630SPA_FEATURE_BOOKMARKS,631SPA_FEATURE_NONE632};633zfeature_register(SPA_FEATURE_BOOKMARK_V2,634"com.datto:bookmark_v2", "bookmark_v2",635"Support for larger bookmarks",6360, ZFEATURE_TYPE_BOOLEAN, bookmark_v2_deps, sfeatures);637}638639{640static const spa_feature_t encryption_deps[] = {641SPA_FEATURE_EXTENSIBLE_DATASET,642SPA_FEATURE_BOOKMARK_V2,643SPA_FEATURE_NONE644};645zfeature_register(SPA_FEATURE_ENCRYPTION,646"com.datto:encryption", "encryption",647"Support for dataset level encryption",648ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN,649encryption_deps, sfeatures);650}651652{653static const spa_feature_t project_quota_deps[] = {654SPA_FEATURE_EXTENSIBLE_DATASET,655SPA_FEATURE_NONE656};657zfeature_register(SPA_FEATURE_PROJECT_QUOTA,658"org.zfsonlinux:project_quota", "project_quota",659"space/object accounting based on project ID.",660ZFEATURE_FLAG_READONLY_COMPAT | ZFEATURE_FLAG_PER_DATASET,661ZFEATURE_TYPE_BOOLEAN, project_quota_deps, sfeatures);662}663664zfeature_register(SPA_FEATURE_ALLOCATION_CLASSES,665"org.zfsonlinux:allocation_classes", "allocation_classes",666"Support for separate allocation classes.",667ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,668sfeatures);669670zfeature_register(SPA_FEATURE_RESILVER_DEFER,671"com.datto:resilver_defer", "resilver_defer",672"Support for deferring new resilvers when one is already running.",673ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,674sfeatures);675676zfeature_register(SPA_FEATURE_DEVICE_REBUILD,677"org.openzfs:device_rebuild", "device_rebuild",678"Support for sequential mirror/dRAID device rebuilds",679ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,680sfeatures);681682{683static const spa_feature_t zstd_deps[] = {684SPA_FEATURE_EXTENSIBLE_DATASET,685SPA_FEATURE_NONE686};687zfeature_register(SPA_FEATURE_ZSTD_COMPRESS,688"org.freebsd:zstd_compress", "zstd_compress",689"zstd compression algorithm support.",690ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN, zstd_deps,691sfeatures);692}693694zfeature_register(SPA_FEATURE_DRAID,695"org.openzfs:draid", "draid", "Support for distributed spare RAID",696ZFEATURE_FLAG_MOS, ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);697698{699static const spa_feature_t zilsaxattr_deps[] = {700SPA_FEATURE_EXTENSIBLE_DATASET,701SPA_FEATURE_NONE702};703zfeature_register(SPA_FEATURE_ZILSAXATTR,704"org.openzfs:zilsaxattr", "zilsaxattr",705"Support for xattr=sa extended attribute logging in ZIL.",706ZFEATURE_FLAG_PER_DATASET | ZFEATURE_FLAG_READONLY_COMPAT,707ZFEATURE_TYPE_BOOLEAN, zilsaxattr_deps, sfeatures);708}709710zfeature_register(SPA_FEATURE_HEAD_ERRLOG,711"com.delphix:head_errlog", "head_errlog",712"Support for per-dataset on-disk error logs.",713ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, ZFEATURE_TYPE_BOOLEAN, NULL,714sfeatures);715716{717static const spa_feature_t blake3_deps[] = {718SPA_FEATURE_EXTENSIBLE_DATASET,719SPA_FEATURE_NONE720};721zfeature_register(SPA_FEATURE_BLAKE3,722"org.openzfs:blake3", "blake3",723"BLAKE3 hash algorithm.",724ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN,725blake3_deps, sfeatures);726}727728zfeature_register(SPA_FEATURE_BLOCK_CLONING,729"com.fudosecurity:block_cloning", "block_cloning",730"Support for block cloning via Block Reference Table.",731ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,732sfeatures);733734zfeature_register(SPA_FEATURE_BLOCK_CLONING_ENDIAN,735"com.truenas:block_cloning_endian", "block_cloning_endian",736"Fixes BRT ZAP endianness on new pools.",737ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,738sfeatures);739740zfeature_register(SPA_FEATURE_AVZ_V2,741"com.klarasystems:vdev_zaps_v2", "vdev_zaps_v2",742"Support for root vdev ZAP.",743ZFEATURE_FLAG_MOS, ZFEATURE_TYPE_BOOLEAN, NULL,744sfeatures);745746{747static const spa_feature_t redact_list_spill_deps[] = {748SPA_FEATURE_REDACTION_BOOKMARKS,749SPA_FEATURE_NONE750};751zfeature_register(SPA_FEATURE_REDACTION_LIST_SPILL,752"com.delphix:redaction_list_spill", "redaction_list_spill",753"Support for increased number of redaction_snapshot "754"arguments in zfs redact.", 0, ZFEATURE_TYPE_BOOLEAN,755redact_list_spill_deps, sfeatures);756}757758zfeature_register(SPA_FEATURE_RAIDZ_EXPANSION,759"org.openzfs:raidz_expansion", "raidz_expansion",760"Support for raidz expansion",761ZFEATURE_FLAG_MOS, ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);762763zfeature_register(SPA_FEATURE_FAST_DEDUP,764"com.klarasystems:fast_dedup", "fast_dedup",765"Support for advanced deduplication",766ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL,767sfeatures);768769{770static const spa_feature_t longname_deps[] = {771SPA_FEATURE_EXTENSIBLE_DATASET,772SPA_FEATURE_NONE773};774zfeature_register(SPA_FEATURE_LONGNAME,775"org.zfsonlinux:longname", "longname",776"support filename up to 1024 bytes",777ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN,778longname_deps, sfeatures);779}780781{782static const spa_feature_t large_microzap_deps[] = {783SPA_FEATURE_EXTENSIBLE_DATASET,784SPA_FEATURE_LARGE_BLOCKS,785SPA_FEATURE_NONE786};787zfeature_register(SPA_FEATURE_LARGE_MICROZAP,788"com.klarasystems:large_microzap", "large_microzap",789"Support for microzaps larger than 128KB.",790ZFEATURE_FLAG_PER_DATASET | ZFEATURE_FLAG_READONLY_COMPAT,791ZFEATURE_TYPE_BOOLEAN, large_microzap_deps, sfeatures);792}793794zfeature_register(SPA_FEATURE_DYNAMIC_GANG_HEADER,795"com.klarasystems:dynamic_gang_header", "dynamic_gang_header",796"Support for dynamically sized gang headers",797ZFEATURE_FLAG_MOS | ZFEATURE_FLAG_NO_UPGRADE,798ZFEATURE_TYPE_BOOLEAN, NULL, sfeatures);799800{801static const spa_feature_t physical_rewrite_deps[] = {802SPA_FEATURE_EXTENSIBLE_DATASET,803SPA_FEATURE_NONE804};805zfeature_register(SPA_FEATURE_PHYSICAL_REWRITE,806"com.truenas:physical_rewrite", "physical_rewrite",807"Support for preserving logical birth time during rewrite.",808ZFEATURE_FLAG_READONLY_COMPAT | ZFEATURE_FLAG_PER_DATASET,809ZFEATURE_TYPE_BOOLEAN, physical_rewrite_deps, sfeatures);810}811812zfs_mod_list_supported_free(sfeatures);813}814815#if defined(_KERNEL)816EXPORT_SYMBOL(zfeature_lookup_guid);817EXPORT_SYMBOL(zfeature_lookup_name);818EXPORT_SYMBOL(zfeature_is_supported);819EXPORT_SYMBOL(zfeature_is_valid_guid);820EXPORT_SYMBOL(zfeature_depends_on);821EXPORT_SYMBOL(zpool_feature_init);822EXPORT_SYMBOL(spa_feature_table);823#endif824825826