xfs: report runtime failures in scrub

Add a new counter so that we can track the number of runtime failures
encountered during scrubs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Darrick J. Wong 2026-09-08 23:03:33 -07:00 committed by Carlos Maiolino
parent 0ae61c331e
commit d3dc979a49

View File

@ -29,6 +29,7 @@ struct xchk_scrub_stats {
uint32_t incomplete;
uint32_t warning;
uint32_t retries;
uint32_t runtime_errors;
/* repair stats */
uint32_t repair_invocations;
@ -110,7 +111,7 @@ xchk_stats_format(
spin_unlock(&css->css_lock);
ret = scnprintf(buf, remaining,
"%s %u %u %u %u %u %u %u %u %u %llu %u %u %llu\n",
"%s %u %u %u %u %u %u %u %u %u %llu %u %u %llu %u\n",
name_map[i],
(unsigned int)fss.invocations,
(unsigned int)fss.clean,
@ -124,7 +125,8 @@ xchk_stats_format(
(unsigned long long)fss.checktime_us,
(unsigned int)fss.repair_invocations,
(unsigned int)fss.repair_success,
(unsigned long long)fss.repairtime_us);
(unsigned long long)fss.repairtime_us,
(unsigned int)fss.runtime_errors);
if (ret <= 0)
break;
@ -207,13 +209,17 @@ xchk_stats_merge_one(
}
/* caller applies this same transformation after we return */
if (error == -EFSCORRUPTED || error == -EFSBADCRC)
if (error == -EFSCORRUPTED || error == -EFSBADCRC) {
sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
error = 0;
}
css = &cs->cs_stats[sm->sm_type];
spin_lock(&css->css_lock);
css->invocations++;
if (!(sm_flags & XFS_SCRUB_OFLAG_UNCLEAN))
if (error)
css->runtime_errors++;
else if (!(sm_flags & XFS_SCRUB_OFLAG_UNCLEAN))
css->clean++;
if (sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
css->corrupt++;