FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c
/*
 * Process a list of errors into the current on-disk log.
 */
Process a list of errors into the current on-disk log.
Process a list of errors into the current on - disk log .
static void
sync_error_list(spa_t *spa, avl_tree_t *t, uint64_t *obj, dmu_tx_t *tx)
{
	spa_error_entry_t *se;
	char buf[64];
	void *cookie;
	if (avl_numnodes(t) != 0) {
		if (*obj == 0)
			*obj = zap_create(spa->spa_meta_objset,
			    DMU_OT_ERROR_LOG, DMU_OT_NONE,
			    0, tx);
		for (se = avl_first(t); se != NULL; se = AVL_NEXT(t, se)) {
			char *name = se->se_name ? se->se_name : "";
			bookmark_to_name(&se->se_bookmark, buf, sizeof (buf));
			(void) zap_update(spa->spa_meta_objset,
			    *obj, buf, 1, strlen(name) + 1, name, tx);
		}
		cookie = NULL;
		while ((se = avl_destroy_nodes(t, &cookie)) != NULL)
			kmem_free(se, sizeof (spa_error_entry_t));
	}
}
static void sync_error_list ( spa_t * spa , avl_tree_t * t , uint64_t * obj , dmu_tx_t * tx ) { spa_error_entry_t * se ; char buf [ 64 ] ; void * cookie ; if ( avl_numnodes ( t ) != 0 ) { if ( * obj == 0 ) * obj = zap_create ( spa -> spa_meta_objset , DMU_OT_ERROR_LOG , DMU_OT_NONE , 0 , tx ) ; for ( se = avl_first ( t ) ; se != NULL ; se = AVL_NEXT ( t , se ) ) { char * name = se -> se_name ? se -> se_name : " " ; bookmark_to_name ( & se -> se_bookmark , buf , sizeof ( buf ) ) ; ( void ) zap_update ( spa -> spa_meta_objset , * obj , buf , 1 , strlen ( name ) + 1 , name , tx ) ; } cookie = NULL ; while ( ( se = avl_destroy_nodes ( t , & cookie ) ) != NULL ) kmem_free ( se , sizeof ( spa_error_entry_t ) ) ; } }
Process a list of errors into the current on-disk log.
Process a list of errors into the current on - disk log .
/* create log if necessary */ /* add errors to the current log */ /* purge the error list */