spa_history.c (229578) | spa_history.c (243674) |
---|---|
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 --- 292 unchanged lines hidden (view full) --- 301spa_history_log(spa_t *spa, const char *history_str, history_log_type_t what) 302{ 303 history_arg_t *ha; 304 int err = 0; 305 dmu_tx_t *tx; 306 307 ASSERT(what != LOG_INTERNAL); 308 | 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 --- 292 unchanged lines hidden (view full) --- 301spa_history_log(spa_t *spa, const char *history_str, history_log_type_t what) 302{ 303 history_arg_t *ha; 304 int err = 0; 305 dmu_tx_t *tx; 306 307 ASSERT(what != LOG_INTERNAL); 308 |
309 if (spa_version(spa) < SPA_VERSION_ZPOOL_HISTORY || !spa_writeable(spa)) 310 return (EINVAL); 311 |
|
309 tx = dmu_tx_create_dd(spa_get_dsl(spa)->dp_mos_dir); 310 err = dmu_tx_assign(tx, TXG_WAIT); 311 if (err) { 312 dmu_tx_abort(tx); 313 return (err); 314 } 315 316 ha = kmem_alloc(sizeof (history_arg_t), KM_SLEEP); --- 113 unchanged lines hidden (view full) --- 430 dmu_tx_t *tx, const char *fmt, va_list adx) 431{ 432 history_arg_t *ha; 433 va_list adx2; 434 435 /* 436 * If this is part of creating a pool, not everything is 437 * initialized yet, so don't bother logging the internal events. | 312 tx = dmu_tx_create_dd(spa_get_dsl(spa)->dp_mos_dir); 313 err = dmu_tx_assign(tx, TXG_WAIT); 314 if (err) { 315 dmu_tx_abort(tx); 316 return (err); 317 } 318 319 ha = kmem_alloc(sizeof (history_arg_t), KM_SLEEP); --- 113 unchanged lines hidden (view full) --- 433 dmu_tx_t *tx, const char *fmt, va_list adx) 434{ 435 history_arg_t *ha; 436 va_list adx2; 437 438 /* 439 * If this is part of creating a pool, not everything is 440 * initialized yet, so don't bother logging the internal events. |
441 * Likewise if the pool is not writeable. |
|
438 */ | 442 */ |
439 if (tx->tx_txg == TXG_INITIAL) | 443 if (tx->tx_txg == TXG_INITIAL || !spa_writeable(spa)) |
440 return; 441 442 va_copy(adx2, adx); 443 444 ha = kmem_alloc(sizeof (history_arg_t), KM_SLEEP); 445 ha->ha_history_str = kmem_alloc(vsnprintf(NULL, 0, fmt, adx2) + 1, 446 KM_SLEEP); 447 --- 64 unchanged lines hidden --- | 444 return; 445 446 va_copy(adx2, adx); 447 448 ha = kmem_alloc(sizeof (history_arg_t), KM_SLEEP); 449 ha->ha_history_str = kmem_alloc(vsnprintf(NULL, 0, fmt, adx2) + 1, 450 KM_SLEEP); 451 --- 64 unchanged lines hidden --- |