1eda14cbcSMatt Macy /* 2eda14cbcSMatt Macy * CDDL HEADER START 3eda14cbcSMatt Macy * 4eda14cbcSMatt Macy * The contents of this file are subject to the terms of the 5eda14cbcSMatt Macy * Common Development and Distribution License (the "License"). 6eda14cbcSMatt Macy * You may not use this file except in compliance with the License. 7eda14cbcSMatt Macy * 8eda14cbcSMatt Macy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9eda14cbcSMatt Macy * or http://www.opensolaris.org/os/licensing. 10eda14cbcSMatt Macy * See the License for the specific language governing permissions 11eda14cbcSMatt Macy * and limitations under the License. 12eda14cbcSMatt Macy * 13eda14cbcSMatt Macy * When distributing Covered Code, include this CDDL HEADER in each 14eda14cbcSMatt Macy * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15eda14cbcSMatt Macy * If applicable, add the following below this CDDL HEADER, with the 16eda14cbcSMatt Macy * fields enclosed by brackets "[]" replaced with your own identifying 17eda14cbcSMatt Macy * information: Portions Copyright [yyyy] [name of copyright owner] 18eda14cbcSMatt Macy * 19eda14cbcSMatt Macy * CDDL HEADER END 20eda14cbcSMatt Macy */ 21eda14cbcSMatt Macy 22eda14cbcSMatt Macy /* 23eda14cbcSMatt Macy * Copyright (c) 2011, 2018 by Delphix. All rights reserved. 24eda14cbcSMatt Macy * Copyright (c) 2013 by Saso Kiselkov. All rights reserved. 25eda14cbcSMatt Macy * Copyright (c) 2013, Joyent, Inc. All rights reserved. 26eda14cbcSMatt Macy * Copyright (c) 2014, Nexenta Systems, Inc. All rights reserved. 27eda14cbcSMatt Macy * Copyright (c) 2017, Intel Corporation. 28eda14cbcSMatt Macy * Copyright (c) 2019, Klara Inc. 29eda14cbcSMatt Macy * Copyright (c) 2019, Allan Jude 30eda14cbcSMatt Macy */ 31eda14cbcSMatt Macy 32eda14cbcSMatt Macy #ifndef _KERNEL 33eda14cbcSMatt Macy #include <errno.h> 34eda14cbcSMatt Macy #include <string.h> 35eda14cbcSMatt Macy #include <sys/stat.h> 36eda14cbcSMatt Macy #endif 37eda14cbcSMatt Macy #include <sys/debug.h> 38eda14cbcSMatt Macy #include <sys/fs/zfs.h> 39eda14cbcSMatt Macy #include <sys/inttypes.h> 40eda14cbcSMatt Macy #include <sys/types.h> 41eda14cbcSMatt Macy #include <sys/param.h> 42eda14cbcSMatt Macy #include <sys/zfs_sysfs.h> 43eda14cbcSMatt Macy #include "zfeature_common.h" 44eda14cbcSMatt Macy 45eda14cbcSMatt Macy /* 46eda14cbcSMatt Macy * Set to disable all feature checks while opening pools, allowing pools with 47eda14cbcSMatt Macy * unsupported features to be opened. Set for testing only. 48eda14cbcSMatt Macy */ 49eda14cbcSMatt Macy boolean_t zfeature_checks_disable = B_FALSE; 50eda14cbcSMatt Macy 51eda14cbcSMatt Macy zfeature_info_t spa_feature_table[SPA_FEATURES]; 52eda14cbcSMatt Macy 53eda14cbcSMatt Macy /* 54eda14cbcSMatt Macy * Valid characters for feature guids. This list is mainly for aesthetic 55eda14cbcSMatt Macy * purposes and could be expanded in the future. There are different allowed 56eda14cbcSMatt Macy * characters in the guids reverse dns portion (before the colon) and its 57eda14cbcSMatt Macy * short name (after the colon). 58eda14cbcSMatt Macy */ 59eda14cbcSMatt Macy static int 60eda14cbcSMatt Macy valid_char(char c, boolean_t after_colon) 61eda14cbcSMatt Macy { 62eda14cbcSMatt Macy return ((c >= 'a' && c <= 'z') || 63eda14cbcSMatt Macy (c >= '0' && c <= '9') || 64eda14cbcSMatt Macy (after_colon && c == '_') || 65eda14cbcSMatt Macy (!after_colon && (c == '.' || c == '-'))); 66eda14cbcSMatt Macy } 67eda14cbcSMatt Macy 68eda14cbcSMatt Macy /* 69eda14cbcSMatt Macy * Every feature guid must contain exactly one colon which separates a reverse 70eda14cbcSMatt Macy * dns organization name from the feature's "short" name (e.g. 71eda14cbcSMatt Macy * "com.company:feature_name"). 72eda14cbcSMatt Macy */ 73eda14cbcSMatt Macy boolean_t 74eda14cbcSMatt Macy zfeature_is_valid_guid(const char *name) 75eda14cbcSMatt Macy { 76eda14cbcSMatt Macy int i; 77eda14cbcSMatt Macy boolean_t has_colon = B_FALSE; 78eda14cbcSMatt Macy 79eda14cbcSMatt Macy i = 0; 80eda14cbcSMatt Macy while (name[i] != '\0') { 81eda14cbcSMatt Macy char c = name[i++]; 82eda14cbcSMatt Macy if (c == ':') { 83eda14cbcSMatt Macy if (has_colon) 84eda14cbcSMatt Macy return (B_FALSE); 85eda14cbcSMatt Macy has_colon = B_TRUE; 86eda14cbcSMatt Macy continue; 87eda14cbcSMatt Macy } 88eda14cbcSMatt Macy if (!valid_char(c, has_colon)) 89eda14cbcSMatt Macy return (B_FALSE); 90eda14cbcSMatt Macy } 91eda14cbcSMatt Macy 92eda14cbcSMatt Macy return (has_colon); 93eda14cbcSMatt Macy } 94eda14cbcSMatt Macy 95eda14cbcSMatt Macy boolean_t 96eda14cbcSMatt Macy zfeature_is_supported(const char *guid) 97eda14cbcSMatt Macy { 98eda14cbcSMatt Macy if (zfeature_checks_disable) 99eda14cbcSMatt Macy return (B_TRUE); 100eda14cbcSMatt Macy 101eda14cbcSMatt Macy for (spa_feature_t i = 0; i < SPA_FEATURES; i++) { 102eda14cbcSMatt Macy zfeature_info_t *feature = &spa_feature_table[i]; 103c170aa9fSMartin Matuska if (!feature->fi_zfs_mod_supported) 104c170aa9fSMartin Matuska continue; 105eda14cbcSMatt Macy if (strcmp(guid, feature->fi_guid) == 0) 106eda14cbcSMatt Macy return (B_TRUE); 107eda14cbcSMatt Macy } 108eda14cbcSMatt Macy return (B_FALSE); 109eda14cbcSMatt Macy } 110eda14cbcSMatt Macy 111eda14cbcSMatt Macy int 112eda14cbcSMatt Macy zfeature_lookup_guid(const char *guid, spa_feature_t *res) 113eda14cbcSMatt Macy { 114eda14cbcSMatt Macy for (spa_feature_t i = 0; i < SPA_FEATURES; i++) { 115eda14cbcSMatt Macy zfeature_info_t *feature = &spa_feature_table[i]; 116eda14cbcSMatt Macy if (!feature->fi_zfs_mod_supported) 117eda14cbcSMatt Macy continue; 118eda14cbcSMatt Macy if (strcmp(guid, feature->fi_guid) == 0) { 119eda14cbcSMatt Macy if (res != NULL) 120eda14cbcSMatt Macy *res = i; 121eda14cbcSMatt Macy return (0); 122eda14cbcSMatt Macy } 123eda14cbcSMatt Macy } 124eda14cbcSMatt Macy 125eda14cbcSMatt Macy return (ENOENT); 126eda14cbcSMatt Macy } 127eda14cbcSMatt Macy 128eda14cbcSMatt Macy int 129eda14cbcSMatt Macy zfeature_lookup_name(const char *name, spa_feature_t *res) 130eda14cbcSMatt Macy { 131eda14cbcSMatt Macy for (spa_feature_t i = 0; i < SPA_FEATURES; i++) { 132eda14cbcSMatt Macy zfeature_info_t *feature = &spa_feature_table[i]; 133eda14cbcSMatt Macy if (!feature->fi_zfs_mod_supported) 134eda14cbcSMatt Macy continue; 135eda14cbcSMatt Macy if (strcmp(name, feature->fi_uname) == 0) { 136eda14cbcSMatt Macy if (res != NULL) 137eda14cbcSMatt Macy *res = i; 138eda14cbcSMatt Macy return (0); 139eda14cbcSMatt Macy } 140eda14cbcSMatt Macy } 141eda14cbcSMatt Macy 142eda14cbcSMatt Macy return (ENOENT); 143eda14cbcSMatt Macy } 144eda14cbcSMatt Macy 145eda14cbcSMatt Macy boolean_t 146eda14cbcSMatt Macy zfeature_depends_on(spa_feature_t fid, spa_feature_t check) 147eda14cbcSMatt Macy { 148eda14cbcSMatt Macy zfeature_info_t *feature = &spa_feature_table[fid]; 149eda14cbcSMatt Macy 150eda14cbcSMatt Macy for (int i = 0; feature->fi_depends[i] != SPA_FEATURE_NONE; i++) { 151eda14cbcSMatt Macy if (feature->fi_depends[i] == check) 152eda14cbcSMatt Macy return (B_TRUE); 153eda14cbcSMatt Macy } 154eda14cbcSMatt Macy return (B_FALSE); 155eda14cbcSMatt Macy } 156eda14cbcSMatt Macy 157eda14cbcSMatt Macy static boolean_t 158eda14cbcSMatt Macy deps_contains_feature(const spa_feature_t *deps, const spa_feature_t feature) 159eda14cbcSMatt Macy { 160eda14cbcSMatt Macy for (int i = 0; deps[i] != SPA_FEATURE_NONE; i++) 161eda14cbcSMatt Macy if (deps[i] == feature) 162eda14cbcSMatt Macy return (B_TRUE); 163eda14cbcSMatt Macy 164eda14cbcSMatt Macy return (B_FALSE); 165eda14cbcSMatt Macy } 166eda14cbcSMatt Macy 167eda14cbcSMatt Macy #if !defined(_KERNEL) && !defined(LIB_ZPOOL_BUILD) 168eda14cbcSMatt Macy static boolean_t 169eda14cbcSMatt Macy zfs_mod_supported_impl(const char *scope, const char *name, const char *sysfs) 170eda14cbcSMatt Macy { 171eda14cbcSMatt Macy boolean_t supported = B_FALSE; 172eda14cbcSMatt Macy char *path; 173eda14cbcSMatt Macy 174eda14cbcSMatt Macy int len = asprintf(&path, "%s%s%s%s%s", sysfs, 175eda14cbcSMatt Macy scope == NULL ? "" : "/", scope == NULL ? "" : scope, 176eda14cbcSMatt Macy name == NULL ? "" : "/", name == NULL ? "" : name); 177eda14cbcSMatt Macy if (len > 0) { 178eda14cbcSMatt Macy struct stat64 statbuf; 179eda14cbcSMatt Macy supported = !!(stat64(path, &statbuf) == 0); 180eda14cbcSMatt Macy free(path); 181eda14cbcSMatt Macy } 182eda14cbcSMatt Macy 183eda14cbcSMatt Macy return (supported); 184eda14cbcSMatt Macy } 185eda14cbcSMatt Macy 186eda14cbcSMatt Macy boolean_t 187eda14cbcSMatt Macy zfs_mod_supported(const char *scope, const char *name) 188eda14cbcSMatt Macy { 189eda14cbcSMatt Macy boolean_t supported; 190eda14cbcSMatt Macy 191eda14cbcSMatt Macy /* 192eda14cbcSMatt Macy * Check both the primary and alternate sysfs locations to determine 193eda14cbcSMatt Macy * if the required functionality is supported. 194eda14cbcSMatt Macy */ 195eda14cbcSMatt Macy supported = (zfs_mod_supported_impl(scope, name, ZFS_SYSFS_DIR) || 196eda14cbcSMatt Macy zfs_mod_supported_impl(scope, name, ZFS_SYSFS_ALT_DIR)); 197eda14cbcSMatt Macy 198eda14cbcSMatt Macy /* 199eda14cbcSMatt Macy * For backwards compatibility with kernel modules that predate 200eda14cbcSMatt Macy * supported feature/property checking. Report the feature/property 201eda14cbcSMatt Macy * as supported if the kernel module is loaded but the requested 202eda14cbcSMatt Macy * scope directory does not exist. 203eda14cbcSMatt Macy */ 204eda14cbcSMatt Macy if (supported == B_FALSE) { 205eda14cbcSMatt Macy struct stat64 statbuf; 206eda14cbcSMatt Macy if ((stat64(ZFS_SYSFS_DIR, &statbuf) == 0) && 207eda14cbcSMatt Macy !zfs_mod_supported_impl(scope, NULL, ZFS_SYSFS_DIR) && 208eda14cbcSMatt Macy !zfs_mod_supported_impl(scope, NULL, ZFS_SYSFS_ALT_DIR)) { 209eda14cbcSMatt Macy supported = B_TRUE; 210eda14cbcSMatt Macy } 211eda14cbcSMatt Macy } 212eda14cbcSMatt Macy 213eda14cbcSMatt Macy return (supported); 214eda14cbcSMatt Macy } 215eda14cbcSMatt Macy #endif 216eda14cbcSMatt Macy 217eda14cbcSMatt Macy static boolean_t 218eda14cbcSMatt Macy zfs_mod_supported_feature(const char *name) 219eda14cbcSMatt Macy { 220eda14cbcSMatt Macy /* 221eda14cbcSMatt Macy * The zfs module spa_feature_table[], whether in-kernel or in 222eda14cbcSMatt Macy * libzpool, always supports all the features. libzfs needs to 223eda14cbcSMatt Macy * query the running module, via sysfs, to determine which 224eda14cbcSMatt Macy * features are supported. 225eda14cbcSMatt Macy * 226eda14cbcSMatt Macy * The equivalent _can_ be done on FreeBSD by way of the sysctl 227ee36e25aSMartin Matuska * tree, but this has not been done yet. Therefore, we return 228ee36e25aSMartin Matuska * that all features except edonr are supported. 229eda14cbcSMatt Macy */ 230*dae17134SMartin Matuska 231*dae17134SMartin Matuska #if defined(_KERNEL) || defined(LIB_ZPOOL_BUILD) || defined(__FreeBSD__) 232eda14cbcSMatt Macy return (B_TRUE); 233eda14cbcSMatt Macy #else 234eda14cbcSMatt Macy return (zfs_mod_supported(ZFS_SYSFS_POOL_FEATURES, name)); 235eda14cbcSMatt Macy #endif 236eda14cbcSMatt Macy } 237eda14cbcSMatt Macy 238eda14cbcSMatt Macy static void 239eda14cbcSMatt Macy zfeature_register(spa_feature_t fid, const char *guid, const char *name, 240eda14cbcSMatt Macy const char *desc, zfeature_flags_t flags, zfeature_type_t type, 241eda14cbcSMatt Macy const spa_feature_t *deps) 242eda14cbcSMatt Macy { 243eda14cbcSMatt Macy zfeature_info_t *feature = &spa_feature_table[fid]; 244eda14cbcSMatt Macy static spa_feature_t nodeps[] = { SPA_FEATURE_NONE }; 245eda14cbcSMatt Macy 246eda14cbcSMatt Macy ASSERT(name != NULL); 247eda14cbcSMatt Macy ASSERT(desc != NULL); 248eda14cbcSMatt Macy ASSERT((flags & ZFEATURE_FLAG_READONLY_COMPAT) == 0 || 249eda14cbcSMatt Macy (flags & ZFEATURE_FLAG_MOS) == 0); 250eda14cbcSMatt Macy ASSERT3U(fid, <, SPA_FEATURES); 251eda14cbcSMatt Macy ASSERT(zfeature_is_valid_guid(guid)); 252eda14cbcSMatt Macy 253eda14cbcSMatt Macy if (deps == NULL) 254eda14cbcSMatt Macy deps = nodeps; 255eda14cbcSMatt Macy 256eda14cbcSMatt Macy VERIFY(((flags & ZFEATURE_FLAG_PER_DATASET) == 0) || 257eda14cbcSMatt Macy (deps_contains_feature(deps, SPA_FEATURE_EXTENSIBLE_DATASET))); 258eda14cbcSMatt Macy 259eda14cbcSMatt Macy feature->fi_feature = fid; 260eda14cbcSMatt Macy feature->fi_guid = guid; 261eda14cbcSMatt Macy feature->fi_uname = name; 262eda14cbcSMatt Macy feature->fi_desc = desc; 263eda14cbcSMatt Macy feature->fi_flags = flags; 264eda14cbcSMatt Macy feature->fi_type = type; 265eda14cbcSMatt Macy feature->fi_depends = deps; 266eda14cbcSMatt Macy feature->fi_zfs_mod_supported = zfs_mod_supported_feature(guid); 267eda14cbcSMatt Macy } 268eda14cbcSMatt Macy 269eda14cbcSMatt Macy /* 270eda14cbcSMatt Macy * Every feature has a GUID of the form com.example:feature_name. The 271eda14cbcSMatt Macy * reversed DNS name ensures that the feature's GUID is unique across all ZFS 272eda14cbcSMatt Macy * implementations. This allows companies to independently develop and 273eda14cbcSMatt Macy * release features. Examples include org.delphix and org.datto. Previously, 274eda14cbcSMatt Macy * features developed on one implementation have used that implementation's 275eda14cbcSMatt Macy * domain name (e.g. org.illumos and org.zfsonlinux). Use of the org.openzfs 276eda14cbcSMatt Macy * domain name is recommended for new features which are developed by the 277eda14cbcSMatt Macy * OpenZFS community and its platforms. This domain may optionally be used by 278eda14cbcSMatt Macy * companies developing features for initial release through an OpenZFS 279eda14cbcSMatt Macy * implementation. Use of the org.openzfs domain requires reserving the 280eda14cbcSMatt Macy * feature name in advance with the OpenZFS project. 281eda14cbcSMatt Macy */ 282eda14cbcSMatt Macy void 283eda14cbcSMatt Macy zpool_feature_init(void) 284eda14cbcSMatt Macy { 285eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_ASYNC_DESTROY, 286eda14cbcSMatt Macy "com.delphix:async_destroy", "async_destroy", 287eda14cbcSMatt Macy "Destroy filesystems asynchronously.", 288eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); 289eda14cbcSMatt Macy 290eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_EMPTY_BPOBJ, 291eda14cbcSMatt Macy "com.delphix:empty_bpobj", "empty_bpobj", 292eda14cbcSMatt Macy "Snapshots use less space.", 293eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); 294eda14cbcSMatt Macy 295eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_LZ4_COMPRESS, 296eda14cbcSMatt Macy "org.illumos:lz4_compress", "lz4_compress", 297eda14cbcSMatt Macy "LZ4 compression algorithm support.", 298eda14cbcSMatt Macy ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, ZFEATURE_TYPE_BOOLEAN, NULL); 299eda14cbcSMatt Macy 300eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_MULTI_VDEV_CRASH_DUMP, 301eda14cbcSMatt Macy "com.joyent:multi_vdev_crash_dump", "multi_vdev_crash_dump", 302eda14cbcSMatt Macy "Crash dumps to multiple vdev pools.", 303eda14cbcSMatt Macy 0, ZFEATURE_TYPE_BOOLEAN, NULL); 304eda14cbcSMatt Macy 305eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_SPACEMAP_HISTOGRAM, 306eda14cbcSMatt Macy "com.delphix:spacemap_histogram", "spacemap_histogram", 307eda14cbcSMatt Macy "Spacemaps maintain space histograms.", 308eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); 309eda14cbcSMatt Macy 310eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_ENABLED_TXG, 311eda14cbcSMatt Macy "com.delphix:enabled_txg", "enabled_txg", 312eda14cbcSMatt Macy "Record txg at which a feature is enabled", 313eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); 314eda14cbcSMatt Macy 315eda14cbcSMatt Macy { 316eda14cbcSMatt Macy static const spa_feature_t hole_birth_deps[] = { 317eda14cbcSMatt Macy SPA_FEATURE_ENABLED_TXG, 318eda14cbcSMatt Macy SPA_FEATURE_NONE 319eda14cbcSMatt Macy }; 320eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_HOLE_BIRTH, 321eda14cbcSMatt Macy "com.delphix:hole_birth", "hole_birth", 322eda14cbcSMatt Macy "Retain hole birth txg for more precise zfs send", 323eda14cbcSMatt Macy ZFEATURE_FLAG_MOS | ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, 324eda14cbcSMatt Macy ZFEATURE_TYPE_BOOLEAN, hole_birth_deps); 325eda14cbcSMatt Macy } 326eda14cbcSMatt Macy 327eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_POOL_CHECKPOINT, 328eda14cbcSMatt Macy "com.delphix:zpool_checkpoint", "zpool_checkpoint", 329eda14cbcSMatt Macy "Pool state can be checkpointed, allowing rewind later.", 330eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); 331eda14cbcSMatt Macy 332eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_SPACEMAP_V2, 333eda14cbcSMatt Macy "com.delphix:spacemap_v2", "spacemap_v2", 334eda14cbcSMatt Macy "Space maps representing large segments are more efficient.", 335eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT | ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, 336eda14cbcSMatt Macy ZFEATURE_TYPE_BOOLEAN, NULL); 337eda14cbcSMatt Macy 338eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_EXTENSIBLE_DATASET, 339eda14cbcSMatt Macy "com.delphix:extensible_dataset", "extensible_dataset", 340eda14cbcSMatt Macy "Enhanced dataset functionality, used by other features.", 341eda14cbcSMatt Macy 0, ZFEATURE_TYPE_BOOLEAN, NULL); 342eda14cbcSMatt Macy 343eda14cbcSMatt Macy { 344eda14cbcSMatt Macy static const spa_feature_t bookmarks_deps[] = { 345eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 346eda14cbcSMatt Macy SPA_FEATURE_NONE 347eda14cbcSMatt Macy }; 348eda14cbcSMatt Macy 349eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_BOOKMARKS, 350eda14cbcSMatt Macy "com.delphix:bookmarks", "bookmarks", 351eda14cbcSMatt Macy "\"zfs bookmark\" command", 352eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, 353eda14cbcSMatt Macy bookmarks_deps); 354eda14cbcSMatt Macy } 355eda14cbcSMatt Macy 356eda14cbcSMatt Macy { 357eda14cbcSMatt Macy static const spa_feature_t filesystem_limits_deps[] = { 358eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 359eda14cbcSMatt Macy SPA_FEATURE_NONE 360eda14cbcSMatt Macy }; 361eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_FS_SS_LIMIT, 362eda14cbcSMatt Macy "com.joyent:filesystem_limits", "filesystem_limits", 363eda14cbcSMatt Macy "Filesystem and snapshot limits.", 364eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, 365eda14cbcSMatt Macy filesystem_limits_deps); 366eda14cbcSMatt Macy } 367eda14cbcSMatt Macy 368eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_EMBEDDED_DATA, 369eda14cbcSMatt Macy "com.delphix:embedded_data", "embedded_data", 370eda14cbcSMatt Macy "Blocks which compress very well use even less space.", 371eda14cbcSMatt Macy ZFEATURE_FLAG_MOS | ZFEATURE_FLAG_ACTIVATE_ON_ENABLE, 372eda14cbcSMatt Macy ZFEATURE_TYPE_BOOLEAN, NULL); 373eda14cbcSMatt Macy 374eda14cbcSMatt Macy { 375eda14cbcSMatt Macy static const spa_feature_t livelist_deps[] = { 376eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 377eda14cbcSMatt Macy SPA_FEATURE_NONE 378eda14cbcSMatt Macy }; 379eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_LIVELIST, 380eda14cbcSMatt Macy "com.delphix:livelist", "livelist", 381eda14cbcSMatt Macy "Improved clone deletion performance.", 382eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, 383eda14cbcSMatt Macy livelist_deps); 384eda14cbcSMatt Macy } 385eda14cbcSMatt Macy 386eda14cbcSMatt Macy { 387eda14cbcSMatt Macy static const spa_feature_t log_spacemap_deps[] = { 388eda14cbcSMatt Macy SPA_FEATURE_SPACEMAP_V2, 389eda14cbcSMatt Macy SPA_FEATURE_NONE 390eda14cbcSMatt Macy }; 391eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_LOG_SPACEMAP, 392eda14cbcSMatt Macy "com.delphix:log_spacemap", "log_spacemap", 393eda14cbcSMatt Macy "Log metaslab changes on a single spacemap and " 394eda14cbcSMatt Macy "flush them periodically.", 395eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, 396eda14cbcSMatt Macy log_spacemap_deps); 397eda14cbcSMatt Macy } 398eda14cbcSMatt Macy 399eda14cbcSMatt Macy { 400eda14cbcSMatt Macy static const spa_feature_t large_blocks_deps[] = { 401eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 402eda14cbcSMatt Macy SPA_FEATURE_NONE 403eda14cbcSMatt Macy }; 404eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_LARGE_BLOCKS, 405eda14cbcSMatt Macy "org.open-zfs:large_blocks", "large_blocks", 406eda14cbcSMatt Macy "Support for blocks larger than 128KB.", 407eda14cbcSMatt Macy ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN, 408eda14cbcSMatt Macy large_blocks_deps); 409eda14cbcSMatt Macy } 410eda14cbcSMatt Macy 411eda14cbcSMatt Macy { 412eda14cbcSMatt Macy static const spa_feature_t large_dnode_deps[] = { 413eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 414eda14cbcSMatt Macy SPA_FEATURE_NONE 415eda14cbcSMatt Macy }; 416eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_LARGE_DNODE, 417eda14cbcSMatt Macy "org.zfsonlinux:large_dnode", "large_dnode", 418eda14cbcSMatt Macy "Variable on-disk size of dnodes.", 419eda14cbcSMatt Macy ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN, 420eda14cbcSMatt Macy large_dnode_deps); 421eda14cbcSMatt Macy } 422eda14cbcSMatt Macy 423eda14cbcSMatt Macy { 424eda14cbcSMatt Macy static const spa_feature_t sha512_deps[] = { 425eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 426eda14cbcSMatt Macy SPA_FEATURE_NONE 427eda14cbcSMatt Macy }; 428eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_SHA512, 429eda14cbcSMatt Macy "org.illumos:sha512", "sha512", 430eda14cbcSMatt Macy "SHA-512/256 hash algorithm.", 431eda14cbcSMatt Macy ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN, 432eda14cbcSMatt Macy sha512_deps); 433eda14cbcSMatt Macy } 434eda14cbcSMatt Macy 435eda14cbcSMatt Macy { 436eda14cbcSMatt Macy static const spa_feature_t skein_deps[] = { 437eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 438eda14cbcSMatt Macy SPA_FEATURE_NONE 439eda14cbcSMatt Macy }; 440eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_SKEIN, 441eda14cbcSMatt Macy "org.illumos:skein", "skein", 442eda14cbcSMatt Macy "Skein hash algorithm.", 443eda14cbcSMatt Macy ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN, 444eda14cbcSMatt Macy skein_deps); 445eda14cbcSMatt Macy } 446eda14cbcSMatt Macy 447eda14cbcSMatt Macy { 448eda14cbcSMatt Macy static const spa_feature_t edonr_deps[] = { 449eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 450eda14cbcSMatt Macy SPA_FEATURE_NONE 451eda14cbcSMatt Macy }; 452eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_EDONR, 453eda14cbcSMatt Macy "org.illumos:edonr", "edonr", 454eda14cbcSMatt Macy "Edon-R hash algorithm.", 455eda14cbcSMatt Macy ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN, 456eda14cbcSMatt Macy edonr_deps); 457eda14cbcSMatt Macy } 458eda14cbcSMatt Macy 459eda14cbcSMatt Macy { 460eda14cbcSMatt Macy static const spa_feature_t redact_books_deps[] = { 461eda14cbcSMatt Macy SPA_FEATURE_BOOKMARK_V2, 462eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 463eda14cbcSMatt Macy SPA_FEATURE_BOOKMARKS, 464eda14cbcSMatt Macy SPA_FEATURE_NONE 465eda14cbcSMatt Macy }; 466eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_REDACTION_BOOKMARKS, 467eda14cbcSMatt Macy "com.delphix:redaction_bookmarks", "redaction_bookmarks", 468eda14cbcSMatt Macy "Support for bookmarks which store redaction lists for zfs " 469eda14cbcSMatt Macy "redacted send/recv.", 0, ZFEATURE_TYPE_BOOLEAN, 470eda14cbcSMatt Macy redact_books_deps); 471eda14cbcSMatt Macy } 472eda14cbcSMatt Macy 473eda14cbcSMatt Macy { 474eda14cbcSMatt Macy static const spa_feature_t redact_datasets_deps[] = { 475eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 476eda14cbcSMatt Macy SPA_FEATURE_NONE 477eda14cbcSMatt Macy }; 478eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_REDACTED_DATASETS, 479eda14cbcSMatt Macy "com.delphix:redacted_datasets", "redacted_datasets", "Support for " 480eda14cbcSMatt Macy "redacted datasets, produced by receiving a redacted zfs send " 481eda14cbcSMatt Macy "stream.", ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_UINT64_ARRAY, 482eda14cbcSMatt Macy redact_datasets_deps); 483eda14cbcSMatt Macy } 484eda14cbcSMatt Macy 485eda14cbcSMatt Macy { 486eda14cbcSMatt Macy static const spa_feature_t bookmark_written_deps[] = { 487eda14cbcSMatt Macy SPA_FEATURE_BOOKMARK_V2, 488eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 489eda14cbcSMatt Macy SPA_FEATURE_BOOKMARKS, 490eda14cbcSMatt Macy SPA_FEATURE_NONE 491eda14cbcSMatt Macy }; 492eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_BOOKMARK_WRITTEN, 493eda14cbcSMatt Macy "com.delphix:bookmark_written", "bookmark_written", 494eda14cbcSMatt Macy "Additional accounting, enabling the written#<bookmark> property" 495eda14cbcSMatt Macy "(space written since a bookmark), and estimates of send stream " 496eda14cbcSMatt Macy "sizes for incrementals from bookmarks.", 497eda14cbcSMatt Macy 0, ZFEATURE_TYPE_BOOLEAN, bookmark_written_deps); 498eda14cbcSMatt Macy } 499eda14cbcSMatt Macy 500eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_DEVICE_REMOVAL, 501eda14cbcSMatt Macy "com.delphix:device_removal", "device_removal", 502eda14cbcSMatt Macy "Top-level vdevs can be removed, reducing logical pool size.", 503eda14cbcSMatt Macy ZFEATURE_FLAG_MOS, ZFEATURE_TYPE_BOOLEAN, NULL); 504eda14cbcSMatt Macy 505eda14cbcSMatt Macy { 506eda14cbcSMatt Macy static const spa_feature_t obsolete_counts_deps[] = { 507eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 508eda14cbcSMatt Macy SPA_FEATURE_DEVICE_REMOVAL, 509eda14cbcSMatt Macy SPA_FEATURE_NONE 510eda14cbcSMatt Macy }; 511eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_OBSOLETE_COUNTS, 512eda14cbcSMatt Macy "com.delphix:obsolete_counts", "obsolete_counts", 513eda14cbcSMatt Macy "Reduce memory used by removed devices when their blocks are " 514eda14cbcSMatt Macy "freed or remapped.", 515eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, 516eda14cbcSMatt Macy obsolete_counts_deps); 517eda14cbcSMatt Macy } 518eda14cbcSMatt Macy 519eda14cbcSMatt Macy { 520eda14cbcSMatt Macy static const spa_feature_t userobj_accounting_deps[] = { 521eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 522eda14cbcSMatt Macy SPA_FEATURE_NONE 523eda14cbcSMatt Macy }; 524eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_USEROBJ_ACCOUNTING, 525eda14cbcSMatt Macy "org.zfsonlinux:userobj_accounting", "userobj_accounting", 526eda14cbcSMatt Macy "User/Group object accounting.", 527eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT | ZFEATURE_FLAG_PER_DATASET, 528eda14cbcSMatt Macy ZFEATURE_TYPE_BOOLEAN, userobj_accounting_deps); 529eda14cbcSMatt Macy } 530eda14cbcSMatt Macy 531eda14cbcSMatt Macy { 532eda14cbcSMatt Macy static const spa_feature_t bookmark_v2_deps[] = { 533eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 534eda14cbcSMatt Macy SPA_FEATURE_BOOKMARKS, 535eda14cbcSMatt Macy SPA_FEATURE_NONE 536eda14cbcSMatt Macy }; 537eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_BOOKMARK_V2, 538eda14cbcSMatt Macy "com.datto:bookmark_v2", "bookmark_v2", 539eda14cbcSMatt Macy "Support for larger bookmarks", 540eda14cbcSMatt Macy 0, ZFEATURE_TYPE_BOOLEAN, bookmark_v2_deps); 541eda14cbcSMatt Macy } 542eda14cbcSMatt Macy 543eda14cbcSMatt Macy { 544eda14cbcSMatt Macy static const spa_feature_t encryption_deps[] = { 545eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 546eda14cbcSMatt Macy SPA_FEATURE_BOOKMARK_V2, 547eda14cbcSMatt Macy SPA_FEATURE_NONE 548eda14cbcSMatt Macy }; 549eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_ENCRYPTION, 550eda14cbcSMatt Macy "com.datto:encryption", "encryption", 551eda14cbcSMatt Macy "Support for dataset level encryption", 552eda14cbcSMatt Macy ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN, 553eda14cbcSMatt Macy encryption_deps); 554eda14cbcSMatt Macy } 555eda14cbcSMatt Macy 556eda14cbcSMatt Macy { 557eda14cbcSMatt Macy static const spa_feature_t project_quota_deps[] = { 558eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 559eda14cbcSMatt Macy SPA_FEATURE_NONE 560eda14cbcSMatt Macy }; 561eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_PROJECT_QUOTA, 562eda14cbcSMatt Macy "org.zfsonlinux:project_quota", "project_quota", 563eda14cbcSMatt Macy "space/object accounting based on project ID.", 564eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT | ZFEATURE_FLAG_PER_DATASET, 565eda14cbcSMatt Macy ZFEATURE_TYPE_BOOLEAN, project_quota_deps); 566eda14cbcSMatt Macy } 567eda14cbcSMatt Macy 568eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_ALLOCATION_CLASSES, 569eda14cbcSMatt Macy "org.zfsonlinux:allocation_classes", "allocation_classes", 570eda14cbcSMatt Macy "Support for separate allocation classes.", 571eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); 572eda14cbcSMatt Macy 573eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_RESILVER_DEFER, 574eda14cbcSMatt Macy "com.datto:resilver_defer", "resilver_defer", 575eda14cbcSMatt Macy "Support for deferring new resilvers when one is already running.", 576eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); 577eda14cbcSMatt Macy 578eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_DEVICE_REBUILD, 579eda14cbcSMatt Macy "org.openzfs:device_rebuild", "device_rebuild", 5807877fdebSMatt Macy "Support for sequential mirror/dRAID device rebuilds", 581eda14cbcSMatt Macy ZFEATURE_FLAG_READONLY_COMPAT, ZFEATURE_TYPE_BOOLEAN, NULL); 582eda14cbcSMatt Macy 583eda14cbcSMatt Macy { 584eda14cbcSMatt Macy static const spa_feature_t zstd_deps[] = { 585eda14cbcSMatt Macy SPA_FEATURE_EXTENSIBLE_DATASET, 586eda14cbcSMatt Macy SPA_FEATURE_NONE 587eda14cbcSMatt Macy }; 588eda14cbcSMatt Macy zfeature_register(SPA_FEATURE_ZSTD_COMPRESS, 589eda14cbcSMatt Macy "org.freebsd:zstd_compress", "zstd_compress", 590eda14cbcSMatt Macy "zstd compression algorithm support.", 591eda14cbcSMatt Macy ZFEATURE_FLAG_PER_DATASET, ZFEATURE_TYPE_BOOLEAN, zstd_deps); 592eda14cbcSMatt Macy } 5937877fdebSMatt Macy 5947877fdebSMatt Macy zfeature_register(SPA_FEATURE_DRAID, 5957877fdebSMatt Macy "org.openzfs:draid", "draid", "Support for distributed spare RAID", 5967877fdebSMatt Macy ZFEATURE_FLAG_MOS, ZFEATURE_TYPE_BOOLEAN, NULL); 597eda14cbcSMatt Macy } 598eda14cbcSMatt Macy 599eda14cbcSMatt Macy #if defined(_KERNEL) 600eda14cbcSMatt Macy EXPORT_SYMBOL(zfeature_lookup_guid); 601eda14cbcSMatt Macy EXPORT_SYMBOL(zfeature_lookup_name); 602eda14cbcSMatt Macy EXPORT_SYMBOL(zfeature_is_supported); 603eda14cbcSMatt Macy EXPORT_SYMBOL(zfeature_is_valid_guid); 604eda14cbcSMatt Macy EXPORT_SYMBOL(zfeature_depends_on); 605eda14cbcSMatt Macy EXPORT_SYMBOL(zpool_feature_init); 606eda14cbcSMatt Macy EXPORT_SYMBOL(spa_feature_table); 607eda14cbcSMatt Macy #endif 608