FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
/*
 * Used in combination with spa_vdev_config_enter() to allow the syncing
 * of multiple transactions without releasing the spa_namespace_lock.
 */
Used in combination with spa_vdev_config_enter() to allow the syncing
of multiple transactions without releasing the spa_namespace_lock.
Used in combination with spa_vdev_config_enter () to allow the syncing of multiple transactions without releasing the spa_namespace_lock .
void
spa_vdev_config_exit(spa_t *spa, vdev_t *vd, uint64_t txg, int error, char *tag)
{
	ASSERT(MUTEX_HELD(&spa_namespace_lock));
	int config_changed = B_FALSE;
	ASSERT(txg > spa_last_synced_txg(spa));
	spa->spa_pending_vdev = NULL;
	vdev_dtl_reassess(spa->spa_root_vdev, 0, 0, B_FALSE);
	if (error == 0 && !list_is_empty(&spa->spa_config_dirty_list)) {
		config_changed = B_TRUE;
		spa->spa_config_generation++;
	}
	ASSERT(metaslab_class_validate(spa_normal_class(spa)) == 0);
	ASSERT(metaslab_class_validate(spa_log_class(spa)) == 0);
	spa_config_exit(spa, SCL_ALL, spa);
	if (zio_injection_enabled)
		zio_handle_panic_injection(spa, tag, 0);
	if (error == 0)
		txg_wait_synced(spa->spa_dsl_pool, txg);
	if (vd != NULL) {
		ASSERT(!vd->vdev_detached || vd->vdev_dtl_sm == NULL);
		spa_config_enter(spa, SCL_ALL, spa, RW_WRITER);
		vdev_free(vd);
		spa_config_exit(spa, SCL_ALL, spa);
	}
	if (config_changed)
		spa_config_sync(spa, B_FALSE, B_TRUE);
}
void spa_vdev_config_exit ( spa_t * spa , vdev_t * vd , uint64_t txg , int error , char * tag ) { ASSERT ( MUTEX_HELD ( & spa_namespace_lock ) ) ; int config_changed = B_FALSE ; ASSERT ( txg > spa_last_synced_txg ( spa ) ) ; spa -> spa_pending_vdev = NULL ; vdev_dtl_reassess ( spa -> spa_root_vdev , 0 , 0 , B_FALSE ) ; if ( error == 0 && ! list_is_empty ( & spa -> spa_config_dirty_list ) ) { config_changed = B_TRUE ; spa -> spa_config_generation ++ ; } ASSERT ( metaslab_class_validate ( spa_normal_class ( spa ) ) == 0 ) ; ASSERT ( metaslab_class_validate ( spa_log_class ( spa ) ) == 0 ) ; spa_config_exit ( spa , SCL_ALL , spa ) ; if ( zio_injection_enabled ) zio_handle_panic_injection ( spa , tag , 0 ) ; if ( error == 0 ) txg_wait_synced ( spa -> spa_dsl_pool , txg ) ; if ( vd != NULL ) { ASSERT ( ! vd -> vdev_detached || vd -> vdev_dtl_sm == NULL ) ; spa_config_enter ( spa , SCL_ALL , spa , RW_WRITER ) ; vdev_free ( vd ) ; spa_config_exit ( spa , SCL_ALL , spa ) ; } if ( config_changed ) spa_config_sync ( spa , B_FALSE , B_TRUE ) ; }
Used in combination with spa_vdev_config_enter() to allow the syncing
 of multiple transactions without releasing the spa_namespace_lock.
Used in combination with spa_vdev_config_enter () to allow the syncing of multiple transactions without releasing the spa_namespace_lock .
/*
	 * Reassess the DTLs.
	 */ /*
	 * Verify the metaslab classes.
	 */ /*
	 * Panic the system if the specified tag requires it.  This
	 * is useful for ensuring that configurations are updated
	 * transactionally.
	 */ /*
	 * Note: this txg_wait_synced() is important because it ensures
	 * that there won't be more than one config change per txg.
	 * This allows us to use the txg as the generation number.
	 */ /*
	 * If the config changed, update the config cache.
	 */