[PATCH 1/6] xfs: disable online repair quota helpers when quota not enabled

Darrick J. Wong
2023-07-27T22:32:43Z

Don't compile the quota helper functions if quota isn't being built into
the XFS module.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/scrub/repair.c | 2 ++
fs/xfs/scrub/repair.h | 9 +++++++++
2 files changed, 11 insertions(+)

diff --git a/fs/xfs/scrub/repair.c b/fs/xfs/scrub/repair.c
index 9e336ab249535..546e8423a9165 100644
--- a/fs/xfs/scrub/repair.c
+++ b/fs/xfs/scrub/repair.c
@@ -683,6 +683,7 @@ xrep_find_ag_btree_roots(
return error;
}

+#ifdef CONFIG_XFS_QUOTA
/* Force a quotacheck the next time we mount. */
void
xrep_force_quotacheck(
@@ -744,6 +745,7 @@ xrep_ino_dqattach(

return error;
}
+#endif /* CONFIG_XFS_QUOTA */

/* Initialize all the btree cursors for an AG repair. */
void
diff --git a/fs/xfs/scrub/repair.h b/fs/xfs/scrub/repair.h
index 42325305d29d9..ac8f0200b2963 100644
--- a/fs/xfs/scrub/repair.h
+++ b/fs/xfs/scrub/repair.h
@@ -50,8 +50,15 @@ struct xrep_find_ag_btree {

int xrep_find_ag_btree_roots(struct xfs_scrub *sc, struct xfs_buf *agf_bp,
struct xrep_find_ag_btree *btree_info, struct xfs_buf *agfl_bp);
+
+#ifdef CONFIG_XFS_QUOTA
void xrep_force_quotacheck(struct xfs_scrub *sc, xfs_dqtype_t type);
int xrep_ino_dqattach(struct xfs_scrub *sc);
+#else
+# define xrep_force_quotacheck(sc, type) ((void)0)
+# define xrep_ino_dqattach(sc) (0)
+#endif /* CONFIG_XFS_QUOTA */
+
int xrep_reset_perag_resv(struct xfs_scrub *sc);

/* Repair setup functions */
@@ -80,6 +87,8 @@ int xrep_reinit_pagi(struct xfs_scrub *sc);

#else

+#define xrep_ino_dqattach(sc) (0)
+
static inline int
xrep_attempt(
struct xfs_scrub *sc,