spa_config.c (185319) | spa_config.c (209962) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 198 unchanged lines hidden (view full) --- 207void 208spa_config_sync(spa_t *target, boolean_t removing, boolean_t postsysevent) 209{ 210 spa_config_dirent_t *dp, *tdp; 211 nvlist_t *nvl; 212 213 ASSERT(MUTEX_HELD(&spa_namespace_lock)); 214 | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 198 unchanged lines hidden (view full) --- 207void 208spa_config_sync(spa_t *target, boolean_t removing, boolean_t postsysevent) 209{ 210 spa_config_dirent_t *dp, *tdp; 211 nvlist_t *nvl; 212 213 ASSERT(MUTEX_HELD(&spa_namespace_lock)); 214 |
215 if (rootdir == NULL || !(spa_mode_global & FWRITE)) 216 return; 217 |
|
215 /* 216 * Iterate over all cachefiles for the pool, past or present. When the 217 * cachefile is changed, the new one is pushed onto this list, allowing 218 * us to update previous cachefiles that no longer contain this pool. 219 */ 220 for (dp = list_head(&target->spa_config_list); dp != NULL; 221 dp = list_next(&target->spa_config_list, dp)) { 222 spa_t *spa = NULL; --- 158 unchanged lines hidden (view full) --- 381 382 if (locked) 383 spa_config_exit(spa, SCL_CONFIG | SCL_STATE, FTAG); 384 385 return (config); 386} 387 388/* | 218 /* 219 * Iterate over all cachefiles for the pool, past or present. When the 220 * cachefile is changed, the new one is pushed onto this list, allowing 221 * us to update previous cachefiles that no longer contain this pool. 222 */ 223 for (dp = list_head(&target->spa_config_list); dp != NULL; 224 dp = list_next(&target->spa_config_list, dp)) { 225 spa_t *spa = NULL; --- 158 unchanged lines hidden (view full) --- 384 385 if (locked) 386 spa_config_exit(spa, SCL_CONFIG | SCL_STATE, FTAG); 387 388 return (config); 389} 390 391/* |
389 * For a pool that's not currently a booting rootpool, update all disk labels, 390 * generate a fresh config based on the current in-core state, and sync the 391 * global config cache. 392 */ 393void 394spa_config_update(spa_t *spa, int what) 395{ 396 spa_config_update_common(spa, what, FALSE); 397} 398 399/* | |
400 * Update all disk labels, generate a fresh config based on the current 401 * in-core state, and sync the global config cache (do not sync the config 402 * cache if this is a booting rootpool). 403 */ 404void | 392 * Update all disk labels, generate a fresh config based on the current 393 * in-core state, and sync the global config cache (do not sync the config 394 * cache if this is a booting rootpool). 395 */ 396void |
405spa_config_update_common(spa_t *spa, int what, boolean_t isroot) | 397spa_config_update(spa_t *spa, int what) |
406{ 407 vdev_t *rvd = spa->spa_root_vdev; 408 uint64_t txg; 409 int c; 410 411 ASSERT(MUTEX_HELD(&spa_namespace_lock)); 412 413 spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); --- 21 unchanged lines hidden (view full) --- 435 /* 436 * Wait for the mosconfig to be regenerated and synced. 437 */ 438 txg_wait_synced(spa->spa_dsl_pool, txg); 439 440 /* 441 * Update the global config cache to reflect the new mosconfig. 442 */ | 398{ 399 vdev_t *rvd = spa->spa_root_vdev; 400 uint64_t txg; 401 int c; 402 403 ASSERT(MUTEX_HELD(&spa_namespace_lock)); 404 405 spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); --- 21 unchanged lines hidden (view full) --- 427 /* 428 * Wait for the mosconfig to be regenerated and synced. 429 */ 430 txg_wait_synced(spa->spa_dsl_pool, txg); 431 432 /* 433 * Update the global config cache to reflect the new mosconfig. 434 */ |
443 if (!isroot) | 435 if (!spa->spa_is_root) |
444 spa_config_sync(spa, B_FALSE, what != SPA_CONFIG_UPDATE_POOL); 445 446 if (what == SPA_CONFIG_UPDATE_POOL) | 436 spa_config_sync(spa, B_FALSE, what != SPA_CONFIG_UPDATE_POOL); 437 438 if (what == SPA_CONFIG_UPDATE_POOL) |
447 spa_config_update_common(spa, SPA_CONFIG_UPDATE_VDEVS, isroot); | 439 spa_config_update(spa, SPA_CONFIG_UPDATE_VDEVS); |
448} | 440} |