Print this page
4171 clean up spa_feature_*() interfaces
4172 implement extensible_dataset feature for use by other zpool features
Reviewed by: Max Grossman <max.grossman@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
@@ -90,49 +90,40 @@
zfeature_is_supported(const char *guid)
{
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)
-{
- for (int i = 0; i < SPA_FEATURES; i++) {
+ for (spa_feature_t 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)
{
- for (int i = 0; i < SPA_FEATURES; i++) {
+ for (spa_feature_t 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);
}
}
return (ENOENT);
}
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);
ASSERT(!readonly || !mos);
ASSERT3U(fid, <, SPA_FEATURES);
@@ -139,10 +130,11 @@
ASSERT(zfeature_is_valid_guid(guid));
if (deps == NULL)
deps = nodeps;
+ feature->fi_feature = fid;
feature->fi_guid = guid;
feature->fi_uname = name;
feature->fi_desc = desc;
feature->fi_can_readonly = readonly;
feature->fi_mos = mos;
@@ -165,6 +157,10 @@
"com.joyent:multi_vdev_crash_dump", "multi_vdev_crash_dump",
"Crash dumps to multiple vdev pools.", B_FALSE, B_FALSE, NULL);
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);
}