From: Darrick J. Wong <djwong@xxxxxxxxxx> If scrub finds that everything is ok with the filesystem, we need a way to tell the health tracking that it can let go of indirect health flags, since indirect flags only mean that at some point in the past we lost some context. Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx> --- libfrog/scrub.c | 5 +++++ libxfs/xfs_fs.h | 3 ++- man/man2/ioctl_xfs_scrub_metadata.2 | 6 ++++++ scrub/scrub.c | 7 +------ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libfrog/scrub.c b/libfrog/scrub.c index b6b8ae042c4..1df2965fe2d 100644 --- a/libfrog/scrub.c +++ b/libfrog/scrub.c @@ -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. */ diff --git a/libxfs/xfs_fs.h b/libxfs/xfs_fs.h index b5c8da7e6aa..ca1b17d0143 100644 --- a/libxfs/xfs_fs.h +++ b/libxfs/xfs_fs.h @@ -714,9 +714,10 @@ struct xfs_scrub_metadata { #define XFS_SCRUB_TYPE_FSCOUNTERS 24 /* fs summary counters */ #define XFS_SCRUB_TYPE_QUOTACHECK 25 /* quota counters */ #define XFS_SCRUB_TYPE_NLINKS 26 /* inode link counts */ +#define XFS_SCRUB_TYPE_HEALTHY 27 /* everything checked out ok */ /* Number of scrub subcommands. */ -#define XFS_SCRUB_TYPE_NR 27 +#define XFS_SCRUB_TYPE_NR 28 /* i: Repair this metadata. */ #define XFS_SCRUB_IFLAG_REPAIR (1u << 0) diff --git a/man/man2/ioctl_xfs_scrub_metadata.2 b/man/man2/ioctl_xfs_scrub_metadata.2 index 8e8bb72fb3b..9963f1913e6 100644 --- a/man/man2/ioctl_xfs_scrub_metadata.2 +++ b/man/man2/ioctl_xfs_scrub_metadata.2 @@ -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 diff --git a/scrub/scrub.c b/scrub/scrub.c index b7ec54c16a4..cf056779526 100644 --- a/scrub/scrub.c +++ b/scrub/scrub.c @@ -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; }