[PATCH 3/5] libfrog: add online scrub/repair for superblock counters

Darrick J. Wong
2019-09-06T03:33:45Z

From: Darrick J. Wong <darrick.wong@oracle.com>

Wire up the new superblock summary counter ioctls.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
libfrog/scrub.c | 6 ++++++
libfrog/scrub.h | 7 +++++++
scrub/scrub.c | 2 ++
3 files changed, 15 insertions(+)

diff --git a/libfrog/scrub.c b/libfrog/scrub.c
index 228e4339..04e44565 100644
--- a/libfrog/scrub.c
+++ b/libfrog/scrub.c
@@ -129,6 +129,12 @@ const struct xfrog_scrub_descr xfrog_scrubbers[XFS_SCRUB_TYPE_NR] = {
.descr = "project quotas",
.type = XFROG_SCRUB_TYPE_FS,
},
+ [XFS_SCRUB_TYPE_FSCOUNTERS] = {
+ .name = "fscounters",
+ .descr = "filesystem summary counters",
+ .type = XFROG_SCRUB_TYPE_FS,
+ .flags = XFROG_SCRUB_DESCR_SUMMARY,
+ },
};

int
diff --git a/libfrog/scrub.h b/libfrog/scrub.h
index 6fda8975..e43d8c24 100644
--- a/libfrog/scrub.h
+++ b/libfrog/scrub.h
@@ -20,8 +20,15 @@ struct xfrog_scrub_descr {
const char *name;
const char *descr;
enum xfrog_scrub_type type;
+ unsigned int flags;
};

+/*
+ * The type of metadata checked by this scrubber is a summary of other types
+ * of metadata. This scrubber should be run after all the others.
+ */
+#define XFROG_SCRUB_DESCR_SUMMARY (1 << 0)
+
extern const struct xfrog_scrub_descr xfrog_scrubbers[XFS_SCRUB_TYPE_NR];

int xfrog_scrub_metadata(struct xfs_fd *xfd, struct xfs_scrub_metadata *meta);
diff --git a/scrub/scrub.c b/scrub/scrub.c
index 153d29d5..083ed9a1 100644
--- a/scrub/scrub.c
+++ b/scrub/scrub.c
@@ -293,6 +293,8 @@ xfs_scrub_metadata(
for (type = 0; type < XFS_SCRUB_TYPE_NR; type++, sc++) {
if (sc->type != scrub_type)
continue;
+ if (sc->flags & XFROG_SCRUB_DESCR_SUMMARY)
+ continue;

meta.sm_type = type;
meta.sm_flags = 0;