]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: simplify post-run reporting logic
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 1 Nov 2019 21:55:06 +0000 (17:55 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Fri, 1 Nov 2019 21:55:06 +0000 (17:55 -0400)
Simplify the post-run error and warning reporting logic so that in
subsequent patches we can be more specific about what types of things
went wrong.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/xfs_scrub.c

index e9fc3650de55b333030046064fc80161044bc472..c730569450150b28a6621e6dd6332988ac103483 100644 (file)
@@ -516,24 +516,20 @@ report_outcome(
        total_errors = ctx->errors_found + ctx->runtime_errors;
 
        if (total_errors == 0 && ctx->warnings_found == 0) {
        total_errors = ctx->errors_found + ctx->runtime_errors;
 
        if (total_errors == 0 && ctx->warnings_found == 0) {
-               log_info(ctx, _("No errors found."));
+               log_info(ctx, _("No problems found."));
                return;
        }
 
                return;
        }
 
-       if (total_errors == 0) {
-               fprintf(stderr, _("%s: warnings found: %llu\n"), ctx->mntpoint,
-                               ctx->warnings_found);
-               log_warn(ctx, _("warnings found: %llu"), ctx->warnings_found);
-       } else if (ctx->warnings_found == 0) {
+       if (total_errors > 0) {
                fprintf(stderr, _("%s: errors found: %llu\n"), ctx->mntpoint,
                                total_errors);
                log_err(ctx, _("errors found: %llu"), total_errors);
                fprintf(stderr, _("%s: errors found: %llu\n"), ctx->mntpoint,
                                total_errors);
                log_err(ctx, _("errors found: %llu"), total_errors);
-       } else {
-               fprintf(stderr, _("%s: errors found: %llu; warnings found: %llu\n"),
-                               ctx->mntpoint, total_errors,
+       }
+
+       if (ctx->warnings_found > 0) {
+               fprintf(stderr, _("%s: warnings found: %llu\n"), ctx->mntpoint,
                                ctx->warnings_found);
                                ctx->warnings_found);
-               log_err(ctx, _("errors found: %llu; warnings found: %llu"),
-                               total_errors, ctx->warnings_found);
+               log_warn(ctx, _("warnings found: %llu"), ctx->warnings_found);
        }
 
        /*
        }
 
        /*