Lines Matching refs:feature

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
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>"
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
219 * Use an in-memory cache of feature refcounts for quick retrieval.
226 feature_get_refcount(spa_t *spa, zfeature_info_t *feature, uint64_t *res)
228 ASSERT(VALID_FEATURE_FID(feature->fi_feature));
229 if (spa->spa_feat_refcount_cache[feature->fi_feature] ==
233 *res = spa->spa_feat_refcount_cache[feature->fi_feature];
243 feature_get_refcount_from_disk(spa_t *spa, zfeature_info_t *feature,
248 uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
252 * If the pool is currently being created, the feature objects may not
259 feature->fi_guid, sizeof (uint64_t), 1, &refcount);
272 feature_get_enabled_txg(spa_t *spa, zfeature_info_t *feature, uint64_t *res)
276 ASSERT(zfeature_depends_on(feature->fi_feature,
279 if (!spa_feature_is_enabled(spa, feature->fi_feature)) {
286 feature->fi_guid, sizeof (uint64_t), 1, res));
296 feature_sync(spa_t *spa, zfeature_info_t *feature, uint64_t refcount,
299 ASSERT(VALID_FEATURE_OR_NONE(feature->fi_feature));
300 uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
303 VERIFY0(zap_update(spa->spa_meta_objset, zapobj, feature->fi_guid,
313 if (feature->fi_feature != SPA_FEATURE_NONE) {
315 &spa->spa_feat_refcount_cache[feature->fi_feature];
321 spa_deactivate_mos_feature(spa, feature->fi_guid);
322 else if (feature->fi_flags & ZFEATURE_FLAG_MOS)
323 spa_activate_mos_feature(spa, feature->fi_guid, tx);
331 feature_enable_sync(spa_t *spa, zfeature_info_t *feature, dmu_tx_t *tx)
334 (feature->fi_flags & ZFEATURE_FLAG_ACTIVATE_ON_ENABLE) ? 1 : 0;
335 uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
339 ASSERT(zfeature_is_valid_guid(feature->fi_guid));
343 * If the feature is already enabled, ignore the request.
345 if (zap_contains(spa->spa_meta_objset, zapobj, feature->fi_guid) == 0)
348 for (int i = 0; feature->fi_depends[i] != SPA_FEATURE_NONE; i++)
349 spa_feature_enable(spa, feature->fi_depends[i], tx);
352 feature->fi_guid, 1, strlen(feature->fi_desc) + 1,
353 feature->fi_desc, tx));
355 feature_sync(spa, feature, initial_refcount, tx);
369 spa->spa_feat_enabled_txg_obj, feature->fi_guid,
379 zfeature_info_t *feature = &spa_feature_table[fid];
380 uint64_t zapobj = (feature->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ?
385 ASSERT(zfeature_is_valid_guid(feature->fi_guid));
390 VERIFY3U(feature_get_refcount(spa, feature, &refcount), !=, ENOTSUP);
406 feature_sync(spa, feature, refcount, tx);
413 * We create feature flags ZAP objects in two instances: during pool
431 * Enable any required dependencies, then enable the requested feature.
484 * For the feature specified by fid (which must depend on
488 * Returns B_TRUE if the feature is enabled, in which case txg will be filled
489 * with the transaction group in which the specified feature was enabled.
490 * Returns B_FALSE otherwise (i.e. if the feature is not enabled).