Print this page
3742 zfs comments need cleaner, more consistent style
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Alan Somers <alans@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>
Reviewed by:    George Wilson <george.wilson@delphix.com>
Reviewed by:    Eric Schrock <eric.schrock@delphix.com>


 300                 }
 301         }
 302         *generation = spa_config_generation;
 303         mutex_exit(&spa_namespace_lock);
 304 
 305         return (pools);
 306 }
 307 
 308 void
 309 spa_config_set(spa_t *spa, nvlist_t *config)
 310 {
 311         mutex_enter(&spa->spa_props_lock);
 312         if (spa->spa_config != NULL)
 313                 nvlist_free(spa->spa_config);
 314         spa->spa_config = config;
 315         mutex_exit(&spa->spa_props_lock);
 316 }
 317 
 318 /*
 319  * Generate the pool's configuration based on the current in-core state.

 320  * We infer whether to generate a complete config or just one top-level config
 321  * based on whether vd is the root vdev.
 322  */
 323 nvlist_t *
 324 spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t txg, int getstats)
 325 {
 326         nvlist_t *config, *nvroot;
 327         vdev_t *rvd = spa->spa_root_vdev;
 328         unsigned long hostid = 0;
 329         boolean_t locked = B_FALSE;
 330         uint64_t split_guid;
 331 
 332         if (vd == NULL) {
 333                 vd = rvd;
 334                 locked = B_TRUE;
 335                 spa_config_enter(spa, SCL_CONFIG | SCL_STATE, FTAG, RW_READER);
 336         }
 337 
 338         ASSERT(spa_config_held(spa, SCL_CONFIG | SCL_STATE, RW_READER) ==
 339             (SCL_CONFIG | SCL_STATE));




 300                 }
 301         }
 302         *generation = spa_config_generation;
 303         mutex_exit(&spa_namespace_lock);
 304 
 305         return (pools);
 306 }
 307 
 308 void
 309 spa_config_set(spa_t *spa, nvlist_t *config)
 310 {
 311         mutex_enter(&spa->spa_props_lock);
 312         if (spa->spa_config != NULL)
 313                 nvlist_free(spa->spa_config);
 314         spa->spa_config = config;
 315         mutex_exit(&spa->spa_props_lock);
 316 }
 317 
 318 /*
 319  * Generate the pool's configuration based on the current in-core state.
 320  *
 321  * We infer whether to generate a complete config or just one top-level config
 322  * based on whether vd is the root vdev.
 323  */
 324 nvlist_t *
 325 spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t txg, int getstats)
 326 {
 327         nvlist_t *config, *nvroot;
 328         vdev_t *rvd = spa->spa_root_vdev;
 329         unsigned long hostid = 0;
 330         boolean_t locked = B_FALSE;
 331         uint64_t split_guid;
 332 
 333         if (vd == NULL) {
 334                 vd = rvd;
 335                 locked = B_TRUE;
 336                 spa_config_enter(spa, SCL_CONFIG | SCL_STATE, FTAG, RW_READER);
 337         }
 338 
 339         ASSERT(spa_config_held(spa, SCL_CONFIG | SCL_STATE, RW_READER) ==
 340             (SCL_CONFIG | SCL_STATE));