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>


1126          * If the config changed, update the config cache.
1127          */
1128         if (config_changed) {
1129                 mutex_enter(&spa_namespace_lock);
1130                 spa_config_sync(spa, B_FALSE, B_TRUE);
1131                 mutex_exit(&spa_namespace_lock);
1132         }
1133 
1134         return (error);
1135 }
1136 
1137 /*
1138  * ==========================================================================
1139  * Miscellaneous functions
1140  * ==========================================================================
1141  */
1142 
1143 void
1144 spa_activate_mos_feature(spa_t *spa, const char *feature)
1145 {
1146         (void) nvlist_add_boolean(spa->spa_label_features, feature);

1147         vdev_config_dirty(spa->spa_root_vdev);

1148 }
1149 
1150 void
1151 spa_deactivate_mos_feature(spa_t *spa, const char *feature)
1152 {
1153         (void) nvlist_remove_all(spa->spa_label_features, feature);
1154         vdev_config_dirty(spa->spa_root_vdev);
1155 }
1156 
1157 /*
1158  * Rename a spa_t.
1159  */
1160 int
1161 spa_rename(const char *name, const char *newname)
1162 {
1163         spa_t *spa;
1164         int err;
1165 
1166         /*
1167          * Lookup the spa_t and grab the config lock for writing.  We need to
1168          * actually open the pool so that we can sync out the necessary labels.
1169          * It's OK to call spa_open() with the namespace lock held because we
1170          * allow recursive calls for other reasons.
1171          */
1172         mutex_enter(&spa_namespace_lock);
1173         if ((err = spa_open(name, &spa, FTAG)) != 0) {




1126          * If the config changed, update the config cache.
1127          */
1128         if (config_changed) {
1129                 mutex_enter(&spa_namespace_lock);
1130                 spa_config_sync(spa, B_FALSE, B_TRUE);
1131                 mutex_exit(&spa_namespace_lock);
1132         }
1133 
1134         return (error);
1135 }
1136 
1137 /*
1138  * ==========================================================================
1139  * Miscellaneous functions
1140  * ==========================================================================
1141  */
1142 
1143 void
1144 spa_activate_mos_feature(spa_t *spa, const char *feature)
1145 {
1146         if (!nvlist_exists(spa->spa_label_features, feature)) {
1147                 fnvlist_add_boolean(spa->spa_label_features, feature);
1148                 vdev_config_dirty(spa->spa_root_vdev);
1149         }
1150 }
1151 
1152 void
1153 spa_deactivate_mos_feature(spa_t *spa, const char *feature)
1154 {
1155         if (nvlist_remove_all(spa->spa_label_features, feature) == 0)
1156                 vdev_config_dirty(spa->spa_root_vdev);
1157 }
1158 
1159 /*
1160  * Rename a spa_t.
1161  */
1162 int
1163 spa_rename(const char *name, const char *newname)
1164 {
1165         spa_t *spa;
1166         int err;
1167 
1168         /*
1169          * Lookup the spa_t and grab the config lock for writing.  We need to
1170          * actually open the pool so that we can sync out the necessary labels.
1171          * It's OK to call spa_open() with the namespace lock held because we
1172          * allow recursive calls for other reasons.
1173          */
1174         mutex_enter(&spa_namespace_lock);
1175         if ((err = spa_open(name, &spa, FTAG)) != 0) {