Lines Matching defs:spa

52 #include <sys/spa.h>
89 * spa's list of pending errors. The changes are actually synced out to disk
93 spa_log_error(spa_t *spa, zio_t *zio)
105 if (spa_load_state(spa) == SPA_LOAD_TRYIMPORT)
108 mutex_enter(&spa->spa_errlist_lock);
114 if (spa->spa_scrub_active || spa->spa_scrub_finished)
115 tree = &spa->spa_errlist_scrub;
117 tree = &spa->spa_errlist_last;
121 mutex_exit(&spa->spa_errlist_lock);
129 mutex_exit(&spa->spa_errlist_lock);
138 spa_get_errlog_size(spa_t *spa)
142 mutex_enter(&spa->spa_errlog_lock);
143 if (spa->spa_errlog_scrub != 0 &&
144 zap_count(spa->spa_meta_objset, spa->spa_errlog_scrub,
148 if (spa->spa_errlog_last != 0 && !spa->spa_scrub_finished &&
149 zap_count(spa->spa_meta_objset, spa->spa_errlog_last,
152 mutex_exit(&spa->spa_errlog_lock);
154 mutex_enter(&spa->spa_errlist_lock);
155 total += avl_numnodes(&spa->spa_errlist_last);
156 total += avl_numnodes(&spa->spa_errlist_scrub);
157 mutex_exit(&spa->spa_errlist_lock);
164 process_error_log(spa_t *spa, uint64_t obj, void *addr, size_t *count)
173 for (zap_cursor_init(&zc, spa->spa_meta_objset, obj);
233 spa_get_errlog(spa_t *spa, void *uaddr, size_t *count)
238 mutex_enter(&spa->spa_errlog_lock);
240 ret = process_error_log(spa, spa->spa_errlog_scrub, uaddr, count);
242 if (!ret && !spa->spa_scrub_finished)
243 ret = process_error_log(spa, spa->spa_errlog_last, uaddr,
246 mutex_enter(&spa->spa_errlist_lock);
248 ret = process_error_list(&spa->spa_errlist_scrub, uaddr,
251 ret = process_error_list(&spa->spa_errlist_last, uaddr,
253 mutex_exit(&spa->spa_errlist_lock);
255 mutex_exit(&spa->spa_errlog_lock);
267 spa_errlog_rotate(spa_t *spa)
269 mutex_enter(&spa->spa_errlist_lock);
270 spa->spa_scrub_finished = B_TRUE;
271 mutex_exit(&spa->spa_errlist_lock);
279 spa_errlog_drain(spa_t *spa)
284 mutex_enter(&spa->spa_errlist_lock);
287 while ((se = avl_destroy_nodes(&spa->spa_errlist_last,
291 while ((se = avl_destroy_nodes(&spa->spa_errlist_scrub,
295 mutex_exit(&spa->spa_errlist_lock);
302 sync_error_list(spa_t *spa, avl_tree_t *t, uint64_t *obj, dmu_tx_t *tx)
311 *obj = zap_create(spa->spa_meta_objset,
321 (void) zap_update(spa->spa_meta_objset,
343 spa_errlog_sync(spa_t *spa, uint64_t txg)
349 mutex_enter(&spa->spa_errlist_lock);
354 if (avl_numnodes(&spa->spa_errlist_scrub) == 0 &&
355 avl_numnodes(&spa->spa_errlist_last) == 0 &&
356 !spa->spa_scrub_finished) {
357 mutex_exit(&spa->spa_errlist_lock);
361 spa_get_errlists(spa, &last, &scrub);
362 scrub_finished = spa->spa_scrub_finished;
363 spa->spa_scrub_finished = B_FALSE;
365 mutex_exit(&spa->spa_errlist_lock);
366 mutex_enter(&spa->spa_errlog_lock);
368 tx = dmu_tx_create_assigned(spa->spa_dsl_pool, txg);
373 sync_error_list(spa, &last, &spa->spa_errlog_last, tx);
379 if (spa->spa_errlog_last != 0)
380 VERIFY(dmu_object_free(spa->spa_meta_objset,
381 spa->spa_errlog_last, tx) == 0);
382 spa->spa_errlog_last = spa->spa_errlog_scrub;
383 spa->spa_errlog_scrub = 0;
385 sync_error_list(spa, &scrub, &spa->spa_errlog_last, tx);
391 sync_error_list(spa, &scrub, &spa->spa_errlog_scrub, tx);
396 (void) zap_update(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
398 &spa->spa_errlog_last, tx);
399 (void) zap_update(spa->spa_meta_objset, DMU_POOL_DIRECTORY_OBJECT,
401 &spa->spa_errlog_scrub, tx);
405 mutex_exit(&spa->spa_errlog_lock);