Lines Matching full:feature
36 * ZFS Feature Flags
39 * ZFS feature flags are used to provide fine-grained versioning to the ZFS
40 * on-disk format. Once enabled on a pool feature flags replace the old
46 * keep feature GUIDs unique they should consist of the reverse dns name of the
47 * organization which implemented the feature and a short name for the feature,
55 * disk for each feature:
57 * 1) If there is no reference count stored on disk the feature is disabled.
59 * feature, but the feature has not been used yet, so no on-disk
61 * 3) If the reference count is greater than 0 the feature is active.
62 * The format changes required by the feature are currently on disk.
63 * Note that if the feature's format changes are reversed the feature
66 * Feature flags makes no differentiation between non-zero reference counts
67 * for an active feature (e.g. a reference count of 1 means the same thing as a
68 * reference count of 27834721), but feature implementations may choose to use
71 * it. If all those disks are removed from the pool the feature goes back to
75 * reference count as long as the feature's format changes are present on disk.
80 * Each feature may depend on other features. The only effect of this
81 * relationship is that when a feature is enabled all of its dependencies are
89 * When feature flags are enabled spa_version() is set to SPA_VERSION_FEATURES
91 * SPA_VERSION_BEFORE_FEATURES (28) first, so all pre-feature flags on disk
98 * 1) features_for_read: feature GUID -> reference count
100 * 2) features_for_write: feature GUID -> reference count
102 * 3) feature_descriptions: feature GUID -> descriptive string
114 * Some features may be required to read the ZAP objects containing feature
122 * instead any feature whose reference count drops to 0 is removed from the
130 * has arguments to specify if the feature should be stored in the
134 * Once a feature is registered it will appear as a "feature@<feature name>"
135 * property which can be set by an administrator. Feature implementors should
137 * query the state of a feature and the spa_feature_incr() and
138 * spa_feature_decr() functions to change an enabled feature's reference count.
142 * initialization should occur when the feature is first used. This design
144 * should only check if a feature is enabled using spa_feature_is_enabled(),
145 * not by relying on any feature specific metadata existing. If a feature is
146 * enabled, but the feature's metadata is not on disk yet then it should be
149 * As an example, consider the com.delphix:async_destroy feature. This feature
170 * this software. Adds each unsupported feature (name -> description) to
227 * Use an in-memory cache of feature refcounts for quick retrieval.
234 feature_get_refcount(spa_t *spa, zfeature_info_t *feature, uint64_t *res)
236 ASSERT(VALID_FEATURE_FID(feature->fi_feature));
237 if (spa->spa_feat_refcount_cache[feature->fi_feature] ==
241 *res = spa->spa_feat_refcount_cache[feature->fi_feature];
251 feature_get_refcount_from_disk(spa_t *spa, zfeature_info_t *feature,
256 uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
260 * If the pool is currently being created, the feature objects may not
267 feature->fi_guid, sizeof (uint64_t), 1, &refcount);
280 feature_get_enabled_txg(spa_t *spa, zfeature_info_t *feature, uint64_t *res)
284 ASSERT(zfeature_depends_on(feature->fi_feature,
287 if (!spa_feature_is_enabled(spa, feature->fi_feature)) {
294 feature->fi_guid, sizeof (uint64_t), 1, res));
304 feature_sync(spa_t *spa, zfeature_info_t *feature, uint64_t refcount,
307 ASSERT(VALID_FEATURE_OR_NONE(feature->fi_feature));
308 uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
310 VERIFY0(zap_update(spa->spa_meta_objset, zapobj, feature->fi_guid,
320 if (feature->fi_feature != SPA_FEATURE_NONE) {
322 &spa->spa_feat_refcount_cache[feature->fi_feature];
328 spa_deactivate_mos_feature(spa, feature->fi_guid);
329 else if (feature->fi_flags & ZFEATURE_FLAG_MOS)
330 spa_activate_mos_feature(spa, feature->fi_guid, tx);
338 feature_enable_sync(spa_t *spa, zfeature_info_t *feature, dmu_tx_t *tx)
341 (feature->fi_flags & ZFEATURE_FLAG_ACTIVATE_ON_ENABLE) ? 1 : 0;
342 uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
346 ASSERT(zfeature_is_valid_guid(feature->fi_guid));
350 * If the feature is already enabled, ignore the request.
352 if (zap_contains(spa->spa_meta_objset, zapobj, feature->fi_guid) == 0)
355 for (int i = 0; feature->fi_depends[i] != SPA_FEATURE_NONE; i++)
356 spa_feature_enable(spa, feature->fi_depends[i], tx);
359 feature->fi_guid, 1, strlen(feature->fi_desc) + 1,
360 feature->fi_desc, tx));
362 feature_sync(spa, feature, initial_refcount, tx);
376 spa->spa_feat_enabled_txg_obj, feature->fi_guid,
382 * is also a problem where the old encryption feature did not
383 * depend on the bookmark_v2 feature. If the pool does not have
390 feature->fi_feature == SPA_FEATURE_BOOKMARK_V2)
395 * the head_errlog feature.
397 if (feature->fi_feature == SPA_FEATURE_HEAD_ERRLOG)
406 zfeature_info_t *feature = &spa_feature_table[fid];
408 (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
413 ASSERT(zfeature_is_valid_guid(feature->fi_guid));
418 VERIFY3U(feature_get_refcount(spa, feature, &refcount), !=, ENOTSUP);
434 feature_sync(spa, feature, refcount, tx);
441 * We create feature flags ZAP objects in two instances: during pool
459 * Enable any required dependencies, then enable the requested feature.
512 * For the feature specified by fid (which must depend on
516 * Returns B_TRUE if the feature is enabled, in which case txg will be filled
517 * with the transaction group in which the specified feature was enabled.
518 * Returns B_FALSE otherwise (i.e. if the feature is not enabled).