[PATCH 2/8] xfs_scrub: collapse trivial superblock scrub helpers

Darrick J. Wong
2023-12-31T22:38:47Z

Remove the trivial primary super scrub helper function since it makes
tracing code paths difficult and will become annoying in the patches
that follow.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
scrub/phase2.c | 9 +++++----
scrub/scrub.c | 16 +---------------
scrub/scrub.h | 3 ++-
3 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/scrub/phase2.c b/scrub/phase2.c
index 2d49c604eae..ec72bb5b71a 100644
--- a/scrub/phase2.c
+++ b/scrub/phase2.c
@@ -166,12 +166,13 @@ phase2_func(
}

/*
- * In case we ever use the primary super scrubber to perform fs
- * upgrades (followed by a full scrub), do that before we launch
- * anything else.
+ * Scrub primary superblock. This will be useful if we ever need to
+ * hook a filesystem-wide pre-scrub activity (e.g. enable filesystem
+ * upgrades) off of the sb 0 scrubber (which currently does nothing).
+ * If errors occur, this function will log them and return nonzero.
*/
action_list_init(&alist);
- ret = scrub_primary_super(ctx, &alist);
+ ret = scrub_meta_type(ctx, XFS_SCRUB_TYPE_SB, 0, &alist);
if (ret)
goto out_wq;
ret = action_list_process(ctx, -1, &alist,
diff --git a/scrub/scrub.c b/scrub/scrub.c
index 59583913031..c2e56e5f1cb 100644
--- a/scrub/scrub.c
+++ b/scrub/scrub.c
@@ -259,7 +259,7 @@ scrub_save_repair(
* Returns 0 for success. If errors occur, this function will log them and
* return a positive error code.
*/
-static int
+int
scrub_meta_type(
struct scrub_ctx *ctx,
unsigned int type,
@@ -325,20 +325,6 @@ scrub_group(
return 0;
}

-/*
- * Scrub primary superblock. This will be useful if we ever need to hook
- * a filesystem-wide pre-scrub activity off of the sb 0 scrubber (which
- * currently does nothing). If errors occur, this function will log them and
- * return nonzero.
- */
-int
-scrub_primary_super(
- struct scrub_ctx *ctx,
- struct action_list *alist)
-{
- return scrub_meta_type(ctx, XFS_SCRUB_TYPE_SB, 0, alist);
-}
-
/* Scrub each AG's header blocks. */
int
scrub_ag_headers(
diff --git a/scrub/scrub.h b/scrub/scrub.h
index 133445e8da6..fef8a596049 100644
--- a/scrub/scrub.h
+++ b/scrub/scrub.h
@@ -17,7 +17,6 @@ enum check_outcome {
struct action_item;

void scrub_report_preen_triggers(struct scrub_ctx *ctx);
-int scrub_primary_super(struct scrub_ctx *ctx, struct action_list *alist);
int scrub_ag_headers(struct scrub_ctx *ctx, xfs_agnumber_t agno,
struct action_list *alist);
int scrub_ag_metadata(struct scrub_ctx *ctx, xfs_agnumber_t agno,
@@ -30,6 +29,8 @@ int scrub_fs_counters(struct scrub_ctx *ctx, struct action_list *alist);
int scrub_quotacheck(struct scrub_ctx *ctx, struct action_list *alist);
int scrub_nlinks(struct scrub_ctx *ctx, struct action_list *alist);
int scrub_clean_health(struct scrub_ctx *ctx, struct action_list *alist);
+int scrub_meta_type(struct scrub_ctx *ctx, unsigned int type,
+ xfs_agnumber_t agno, struct action_list *alist);

bool can_scrub_fs_metadata(struct scrub_ctx *ctx);
bool can_scrub_inode(struct scrub_ctx *ctx);