]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: update health status if we get a clean bill of health
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 17:01:16 +0000 (10:01 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:42 +0000 (11:37 -0700)
If we checked a filesystem and it turned out to be clean, upload that
information into the kernel.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libfrog/scrub.c
man/man2/ioctl_xfs_scrub_metadata.2
scrub/scrub.c

index b6b8ae042c446ef2a476680c3c798c3922a02c68..1df2965fe2d4ad183f741b9cb9410e281925b1b3 100644 (file)
@@ -144,6 +144,11 @@ const struct xfrog_scrub_descr xfrog_scrubbers[XFS_SCRUB_TYPE_NR] = {
                .descr  = "inode link counts",
                .group  = XFROG_SCRUB_GROUP_ISCAN,
        },
+       [XFS_SCRUB_TYPE_HEALTHY] = {
+               .name   = "healthy",
+               .descr  = "retained health records",
+               .group  = XFROG_SCRUB_GROUP_NONE,
+       },
 };
 
 /* Invoke the scrub ioctl.  Returns zero or negative error code. */
index 8e8bb72fb3bfedc187fcfc3e2079d5fe9d4be1cd..9963f1913e60959a7d732df88acf9c503aaf64c5 100644 (file)
@@ -168,6 +168,12 @@ count) for errors.
 .TP
 .B XFS_SCRUB_TYPE_NLINKS
 Scan all inodes in the filesystem to verify each file's link count.
+
+.TP
+.B XFS_SCRUB_TYPE_HEALTHY
+Mark everything healthy after a clean scrub run.
+This clears out all the indirect health problem markers that might remain
+in the system.
 .RE
 
 .PD 1
index a22633a8115758c1ebc23eabe85c6fbf549fbb07..436ccb0ca8c3cd8e8ca4f85c4a14205cb0a43f38 100644 (file)
@@ -39,20 +39,15 @@ format_scrub_descr(
        case XFROG_SCRUB_GROUP_PERAG:
                return snprintf(buf, buflen, _("AG %u %s"), meta->sm_agno,
                                _(sc->descr));
-               break;
        case XFROG_SCRUB_GROUP_INODE:
                return scrub_render_ino_descr(ctx, buf, buflen,
                                meta->sm_ino, meta->sm_gen, "%s",
                                _(sc->descr));
-               break;
        case XFROG_SCRUB_GROUP_FS:
        case XFROG_SCRUB_GROUP_SUMMARY:
        case XFROG_SCRUB_GROUP_ISCAN:
-               return snprintf(buf, buflen, _("%s"), _(sc->descr));
-               break;
        case XFROG_SCRUB_GROUP_NONE:
-               assert(0);
-               break;
+               return snprintf(buf, buflen, _("%s"), _(sc->descr));
        }
        return -1;
 }