Lines Matching defs:spa
29 #include <sys/spa.h>
87 spa_history_create_obj(spa_t *spa, dmu_tx_t *tx)
91 objset_t *mos = spa->spa_meta_objset;
93 ASSERT0(spa->spa_history);
94 spa->spa_history = dmu_object_alloc(mos, DMU_OT_SPA_HISTORY,
100 &spa->spa_history, tx));
102 VERIFY0(dmu_bonus_hold(mos, spa->spa_history, FTAG, &dbp));
113 metaslab_class_get_dspace(spa_normal_class(spa)) / 1000;
124 spa_history_advance_bof(spa_t *spa, spa_history_phys_t *shpp)
126 objset_t *mos = spa->spa_meta_objset;
134 if ((err = dmu_read(mos, spa->spa_history, phys_bof, firstread,
138 if ((err = dmu_read(mos, spa->spa_history,
151 spa_history_write(spa_t *spa, void *buf, uint64_t len, spa_history_phys_t *shpp,
155 objset_t *mos = spa->spa_meta_objset;
158 ASSERT(MUTEX_HELD(&spa->spa_history_lock));
163 if ((err = spa_history_advance_bof(spa, shpp)) != 0) {
171 dmu_write(mos, spa->spa_history, phys_eof, firstwrite, buf, tx);
176 dmu_write(mos, spa->spa_history, shpp->sh_pool_create_len,
198 spa_history_log_notify(spa_t *spa, nvlist_t *nvl)
243 spa_event_notify(spa, NULL, hist_nvl, ESC_ZFS_HISTORY_EVENT);
255 spa_t *spa = dmu_tx_pool(tx)->dp_spa;
256 objset_t *mos = spa->spa_meta_objset;
268 mutex_enter(&spa->spa_history_lock);
269 if (!spa->spa_history)
270 spa_history_create_obj(spa, tx);
271 mutex_exit(&spa->spa_history_lock);
277 VERIFY0(dmu_bonus_hold(mos, spa->spa_history, FTAG, &dbp));
327 spa_history_log_notify(spa, nvl);
336 mutex_enter(&spa->spa_history_lock);
340 ret = spa_history_write(spa, &le_len, sizeof (le_len), shpp, tx);
342 ret = spa_history_write(spa, record_packed, reclen, shpp, tx);
350 mutex_exit(&spa->spa_history_lock);
360 spa_history_log(spa_t *spa, const char *msg)
366 err = spa_history_log_nvl(spa, nvl);
372 spa_history_log_nvl(spa_t *spa, nvlist_t *nvl)
378 if (spa_version(spa) < SPA_VERSION_ZPOOL_HISTORY || !spa_writeable(spa))
386 tx = dmu_tx_create_dd(spa_get_dsl(spa)->dp_mos_dir);
393 ASSERT3UF(tx->tx_txg, <=, spa_final_dirty_txg(spa),
410 dsl_sync_task_nowait(spa_get_dsl(spa), spa_history_log_sync, nvarg, tx);
421 spa_history_get(spa_t *spa, uint64_t *offp, uint64_t *len, char *buf)
423 objset_t *mos = spa->spa_meta_objset;
434 if (!spa->spa_history)
442 if (*offp == 0 && spa_writeable(spa))
443 txg_wait_synced(spa_get_dsl(spa), 0);
445 if ((err = dmu_bonus_hold(mos, spa->spa_history, FTAG, &dbp)) != 0)
457 mutex_enter(&spa->spa_history_lock);
497 mutex_exit(&spa->spa_history_lock);
502 err = dmu_read(mos, spa->spa_history, phys_read_off, read_len, buf,
505 err = dmu_read(mos, spa->spa_history, shpp->sh_pool_create_len,
508 mutex_exit(&spa->spa_history_lock);
518 log_internal(nvlist_t *nvl, const char *operation, spa_t *spa,
528 if (spa_is_initializing(spa) || !spa_writeable(spa)) {
533 ASSERT3UF(tx->tx_txg, <=, spa_final_dirty_txg(spa),
547 dsl_sync_task_nowait(spa_get_dsl(spa),
554 spa_history_log_internal(spa_t *spa, const char *operation,
562 htx = dmu_tx_create_dd(spa_get_dsl(spa)->dp_mos_dir);
570 log_internal(fnvlist_alloc(), operation, spa, htx, fmt, adx);
618 spa_history_log_version(spa_t *spa, const char *operation, dmu_tx_t *tx)
622 spa_history_log_internal(spa, operation, tx,
624 (u_longlong_t)spa_version(spa), ZFS_META_GITREV,