summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/rtsummary.c
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 10:59:04 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-12-15 17:29:02 -0800
commita72e974d1b31e1d23f088e3f910d33094da2e174 (patch)
tree4530bc3b81887b7e1723d2c098fdd5982268c211 /fs/xfs/scrub/rtsummary.c
parent4624f8c76088688180c5a5a455a89d47935fa570 (diff)
xfs: online repair of realtime summariesrepair-rtsummary_2021-12-15
Repair the realtime summary data by constructing a new rtsummary file in the scrub temporary file, then atomically swapping the contents. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/scrub/rtsummary.c')
-rw-r--r--fs/xfs/scrub/rtsummary.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/xfs/scrub/rtsummary.c b/fs/xfs/scrub/rtsummary.c
index e401abba6b23..b8fb3923f7f7 100644
--- a/fs/xfs/scrub/rtsummary.c
+++ b/fs/xfs/scrub/rtsummary.c
@@ -20,6 +20,8 @@
#include "scrub/common.h"
#include "scrub/trace.h"
#include "scrub/xfile.h"
+#include "scrub/repair.h"
+#include "scrub/tempfile.h"
/*
* Realtime Summary
@@ -37,8 +39,15 @@ xchk_setup_rtsummary(
struct xfs_scrub *sc)
{
struct xfs_mount *mp = sc->mp;
+ unsigned int resblks = 0;
int error;
+ if (xchk_could_repair(sc)) {
+ error = xrep_setup_rtsummary(sc, &resblks);
+ if (error)
+ return error;
+ }
+
/*
* Create an xfile to construct a new rtsummary file. The xfile allows
* us to avoid pinning kernel memory for this purpose.
@@ -48,7 +57,7 @@ xchk_setup_rtsummary(
if (error)
return error;
- error = xchk_trans_alloc(sc, 0);
+ error = xchk_trans_alloc(sc, resblks);
if (error)
return error;