Lines Matching refs:spa

87 spa_history_create_obj(spa_t *spa, dmu_tx_t *tx)  in spa_history_create_obj()  argument
91 objset_t *mos = spa->spa_meta_objset; in spa_history_create_obj()
93 ASSERT(spa->spa_history == 0); in spa_history_create_obj()
94 spa->spa_history = dmu_object_alloc(mos, DMU_OT_SPA_HISTORY, in spa_history_create_obj()
100 &spa->spa_history, tx) == 0); in spa_history_create_obj()
102 VERIFY(0 == dmu_bonus_hold(mos, spa->spa_history, FTAG, &dbp)); in spa_history_create_obj()
113 metaslab_class_get_dspace(spa_normal_class(spa)) / 1000; in spa_history_create_obj()
124 spa_history_advance_bof(spa_t *spa, spa_history_phys_t *shpp) in spa_history_advance_bof() argument
126 objset_t *mos = spa->spa_meta_objset; in spa_history_advance_bof()
134 if ((err = dmu_read(mos, spa->spa_history, phys_bof, firstread, in spa_history_advance_bof()
138 if ((err = dmu_read(mos, spa->spa_history, in spa_history_advance_bof()
151 spa_history_write(spa_t *spa, void *buf, uint64_t len, spa_history_phys_t *shpp, in spa_history_write() argument
155 objset_t *mos = spa->spa_meta_objset; in spa_history_write()
158 ASSERT(MUTEX_HELD(&spa->spa_history_lock)); in spa_history_write()
163 if ((err = spa_history_advance_bof(spa, shpp)) != 0) { in spa_history_write()
171 dmu_write(mos, spa->spa_history, phys_eof, firstwrite, buf, tx); in spa_history_write()
176 dmu_write(mos, spa->spa_history, shpp->sh_pool_create_len, in spa_history_write()
210 spa_history_log_notify(spa_t *spa, nvlist_t *nvl) in spa_history_log_notify() argument
255 spa_event_notify(spa, NULL, hist_nvl, ESC_ZFS_HISTORY_EVENT); in spa_history_log_notify()
268 spa_t *spa = dmu_tx_pool(tx)->dp_spa; in spa_history_log_sync() local
269 objset_t *mos = spa->spa_meta_objset; in spa_history_log_sync()
281 mutex_enter(&spa->spa_history_lock); in spa_history_log_sync()
282 if (!spa->spa_history) in spa_history_log_sync()
283 spa_history_create_obj(spa, tx); in spa_history_log_sync()
284 mutex_exit(&spa->spa_history_lock); in spa_history_log_sync()
290 VERIFY0(dmu_bonus_hold(mos, spa->spa_history, FTAG, &dbp)); in spa_history_log_sync()
339 spa_history_log_notify(spa, nvl); in spa_history_log_sync()
347 mutex_enter(&spa->spa_history_lock); in spa_history_log_sync()
351 ret = spa_history_write(spa, &le_len, sizeof (le_len), shpp, tx); in spa_history_log_sync()
353 ret = spa_history_write(spa, record_packed, reclen, shpp, tx); in spa_history_log_sync()
361 mutex_exit(&spa->spa_history_lock); in spa_history_log_sync()
371 spa_history_log(spa_t *spa, const char *msg) in spa_history_log() argument
377 err = spa_history_log_nvl(spa, nvl); in spa_history_log()
383 spa_history_log_nvl(spa_t *spa, nvlist_t *nvl) in spa_history_log_nvl() argument
389 if (spa_version(spa) < SPA_VERSION_ZPOOL_HISTORY || !spa_writeable(spa)) in spa_history_log_nvl()
397 tx = dmu_tx_create_dd(spa_get_dsl(spa)->dp_mos_dir); in spa_history_log_nvl()
412 dsl_sync_task_nowait(spa_get_dsl(spa), spa_history_log_sync, in spa_history_log_nvl()
425 spa_history_get(spa_t *spa, uint64_t *offp, uint64_t *len, char *buf) in spa_history_get() argument
427 objset_t *mos = spa->spa_meta_objset; in spa_history_get()
438 if (!spa->spa_history) in spa_history_get()
446 if (*offp == 0 && spa_writeable(spa)) in spa_history_get()
447 txg_wait_synced(spa_get_dsl(spa), 0); in spa_history_get()
449 if ((err = dmu_bonus_hold(mos, spa->spa_history, FTAG, &dbp)) != 0) in spa_history_get()
461 mutex_enter(&spa->spa_history_lock); in spa_history_get()
501 mutex_exit(&spa->spa_history_lock); in spa_history_get()
506 err = dmu_read(mos, spa->spa_history, phys_read_off, read_len, buf, in spa_history_get()
509 err = dmu_read(mos, spa->spa_history, shpp->sh_pool_create_len, in spa_history_get()
512 mutex_exit(&spa->spa_history_lock); in spa_history_get()
522 log_internal(nvlist_t *nvl, const char *operation, spa_t *spa, in log_internal() argument
532 if (tx->tx_txg == TXG_INITIAL || !spa_writeable(spa)) { in log_internal()
548 dsl_sync_task_nowait(spa_get_dsl(spa), in log_internal()
555 spa_history_log_internal(spa_t *spa, const char *operation, in spa_history_log_internal() argument
563 htx = dmu_tx_create_dd(spa_get_dsl(spa)->dp_mos_dir); in spa_history_log_internal()
571 log_internal(fnvlist_alloc(), operation, spa, htx, fmt, adx); in spa_history_log_internal()
619 spa_history_log_version(spa_t *spa, const char *operation) in spa_history_log_version() argument
621 spa_history_log_internal(spa, operation, NULL, in spa_history_log_version()
623 (u_longlong_t)spa_version(spa), SPA_VERSION, ZPL_VERSION, in spa_history_log_version()