FreeBSD/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c
/*
 * Return the number of errors currently in the error log.  This is actually the
 * sum of both the last log and the current log, since we don't know the union
 * of these logs until we reach userland.
 */
Return the number of errors currently in the error log.  This is actually the
sum of both the last log and the current log, since we don't know the union
of these logs until we reach userland.
Return the number of errors currently in the error log . This is actually the sum of both the last log and the current log since we don ' t know the union of these logs until we reach userland .
uint64_t
spa_get_errlog_size(spa_t *spa)
{
	uint64_t total = 0, count;
	mutex_enter(&spa->spa_errlog_lock);
	if (spa->spa_errlog_scrub != 0 &&
	    zap_count(spa->spa_meta_objset, spa->spa_errlog_scrub,
	    &count) == 0)
		total += count;
	if (spa->spa_errlog_last != 0 && !spa->spa_scrub_finished &&
	    zap_count(spa->spa_meta_objset, spa->spa_errlog_last,
	    &count) == 0)
		total += count;
	mutex_exit(&spa->spa_errlog_lock);
	mutex_enter(&spa->spa_errlist_lock);
	total += avl_numnodes(&spa->spa_errlist_last);
	total += avl_numnodes(&spa->spa_errlist_scrub);
	mutex_exit(&spa->spa_errlist_lock);
	return (total);
}
uint64_t spa_get_errlog_size ( spa_t * spa ) { uint64_t total = 0 , count ; mutex_enter ( & spa -> spa_errlog_lock ) ; if ( spa -> spa_errlog_scrub != 0 && zap_count ( spa -> spa_meta_objset , spa -> spa_errlog_scrub , & count ) == 0 ) total += count ; if ( spa -> spa_errlog_last != 0 && ! spa -> spa_scrub_finished && zap_count ( spa -> spa_meta_objset , spa -> spa_errlog_last , & count ) == 0 ) total += count ; mutex_exit ( & spa -> spa_errlog_lock ) ; mutex_enter ( & spa -> spa_errlist_lock ) ; total += avl_numnodes ( & spa -> spa_errlist_last ) ; total += avl_numnodes ( & spa -> spa_errlist_scrub ) ; mutex_exit ( & spa -> spa_errlist_lock ) ; return ( total ) ; }
Return the number of errors currently in the error log.
Return the number of errors currently in the error log .