From fa86b5dbb6d33371df344efb2adb0aba026d097c Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Tue, 8 Oct 2013 09:13:05 -0800 Subject: Illumos 4171, 4172 4171 clean up spa_feature_*() interfaces 4172 implement extensible_dataset feature for use by other zpool features Reviewed by: Max Grossman Reviewed by: Christopher Siden Reviewed by: George Wilson Reviewed by: Jerry Jelinek Approved by: Garrett D'Amore a References: https://www.illumos.org/issues/4171 https://www.illumos.org/issues/4172 https://github.com/illumos/illumos-gate/commit/2acef22 Ported-by: Tim Chase Signed-off-by: Brian Behlendorf Closes #2528 --- module/zfs/zfeature_common.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'module/zfs/zfeature_common.c') diff --git a/module/zfs/zfeature_common.c b/module/zfs/zfeature_common.c index cee544880..5bcc08ade 100644 --- a/module/zfs/zfeature_common.c +++ b/module/zfs/zfeature_common.c @@ -88,39 +88,30 @@ zfeature_is_valid_guid(const char *name) boolean_t zfeature_is_supported(const char *guid) { + spa_feature_t i; + if (zfeature_checks_disable) return (B_TRUE); - return (0 == zfeature_lookup_guid(guid, NULL)); -} - -int -zfeature_lookup_guid(const char *guid, zfeature_info_t **res) -{ - int i; - for (i = 0; i < SPA_FEATURES; i++) { zfeature_info_t *feature = &spa_feature_table[i]; - if (strcmp(guid, feature->fi_guid) == 0) { - if (res != NULL) - *res = feature; - return (0); - } + if (strcmp(guid, feature->fi_guid) == 0) + return (B_TRUE); } - return (ENOENT); + return (B_FALSE); } int -zfeature_lookup_name(const char *name, zfeature_info_t **res) +zfeature_lookup_name(const char *name, spa_feature_t *res) { - int i; + spa_feature_t i; for (i = 0; i < SPA_FEATURES; i++) { zfeature_info_t *feature = &spa_feature_table[i]; if (strcmp(name, feature->fi_uname) == 0) { if (res != NULL) - *res = feature; + *res = i; return (0); } } @@ -129,11 +120,12 @@ zfeature_lookup_name(const char *name, zfeature_info_t **res) } static void -zfeature_register(int fid, const char *guid, const char *name, const char *desc, - boolean_t readonly, boolean_t mos, zfeature_info_t **deps) +zfeature_register(spa_feature_t fid, const char *guid, const char *name, + const char *desc, boolean_t readonly, boolean_t mos, + const spa_feature_t *deps) { zfeature_info_t *feature = &spa_feature_table[fid]; - static zfeature_info_t *nodeps[] = { NULL }; + static spa_feature_t nodeps[] = { SPA_FEATURE_NONE }; ASSERT(name != NULL); ASSERT(desc != NULL); @@ -144,6 +136,7 @@ zfeature_register(int fid, const char *guid, const char *name, const char *desc, if (deps == NULL) deps = nodeps; + feature->fi_feature = fid; feature->fi_guid = guid; feature->fi_uname = name; feature->fi_desc = desc; @@ -167,4 +160,8 @@ zpool_feature_init(void) zfeature_register(SPA_FEATURE_SPACEMAP_HISTOGRAM, "com.delphix:spacemap_histogram", "spacemap_histogram", "Spacemaps maintain space histograms.", B_TRUE, B_FALSE, NULL); + zfeature_register(SPA_FEATURE_EXTENSIBLE_DATASET, + "com.delphix:extensible_dataset", "extensible_dataset", + "Enhanced dataset functionality, used by other features.", + B_FALSE, B_FALSE, NULL); } -- cgit v1.2.3