FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c
/*
 * Log an uncorrectable error to the persistent error log.  We add it to the
 * spa's list of pending errors.  The changes are actually synced out to disk
 * during spa_errlog_sync().
 */
Log an uncorrectable error to the persistent error log.  We add it to the
spa's list of pending errors.  The changes are actually synced out to disk
during spa_errlog_sync().
Log an uncorrectable error to the persistent error log . We add it to the spa ' s list of pending errors . The changes are actually synced out to disk during spa_errlog_sync () .
void
spa_log_error(spa_t *spa, zio_t *zio)
{
	zbookmark_phys_t *zb = &zio->io_logical->io_bookmark;
	spa_error_entry_t search;
	spa_error_entry_t *new;
	avl_tree_t *tree;
	avl_index_t where;
	if (spa_load_state(spa) == SPA_LOAD_TRYIMPORT)
		return;
	mutex_enter(&spa->spa_errlist_lock);
	if (spa->spa_scrub_active || spa->spa_scrub_finished)
		tree = &spa->spa_errlist_scrub;
	else
		tree = &spa->spa_errlist_last;
	search.se_bookmark = *zb;
	if (avl_find(tree, &search, &where) != NULL) {
		mutex_exit(&spa->spa_errlist_lock);
		return;
	}
	new = kmem_zalloc(sizeof (spa_error_entry_t), KM_SLEEP);
	new->se_bookmark = *zb;
	avl_insert(tree, new, where);
	mutex_exit(&spa->spa_errlist_lock);
}
void spa_log_error ( spa_t * spa , zio_t * zio ) { zbookmark_phys_t * zb = & zio -> io_logical -> io_bookmark ; spa_error_entry_t search ; spa_error_entry_t * new ; avl_tree_t * tree ; avl_index_t where ; if ( spa_load_state ( spa ) == SPA_LOAD_TRYIMPORT ) return ; mutex_enter ( & spa -> spa_errlist_lock ) ; if ( spa -> spa_scrub_active || spa -> spa_scrub_finished ) tree = & spa -> spa_errlist_scrub ; else tree = & spa -> spa_errlist_last ; search . se_bookmark = * zb ; if ( avl_find ( tree , & search , & where ) != NULL ) { mutex_exit ( & spa -> spa_errlist_lock ) ; return ; } new = kmem_zalloc ( sizeof ( spa_error_entry_t ) , KM_SLEEP ) ; new -> se_bookmark = * zb ; avl_insert ( tree , new , where ) ; mutex_exit ( & spa -> spa_errlist_lock ) ; }
Log an uncorrectable error to the persistent error log.
Log an uncorrectable error to the persistent error log .
/*
	 * If we are trying to import a pool, ignore any errors, as we won't be
	 * writing to the pool any time soon.
	 */ /*
	 * If we have had a request to rotate the log, log it to the next list
	 * instead of the current one.
	 */