summaryrefslogtreecommitdiff
path: root/fs/xfs/scrub/rtsummary.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/scrub/rtsummary.c')
-rw-r--r--fs/xfs/scrub/rtsummary.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/fs/xfs/scrub/rtsummary.c b/fs/xfs/scrub/rtsummary.c
index 6e71e39e197e..e07292344528 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/rtsummary.h"
/*
* Realtime Summary
@@ -37,8 +39,16 @@ xchk_setup_rtsummary(
struct xfs_scrub *sc)
{
struct xfs_mount *mp = sc->mp;
+ size_t bufsize = mp->m_sb.sb_blocksize;
+ unsigned int resblks = 0;
int error;
+ if (xchk_could_repair(sc)) {
+ error = xrep_setup_rtsummary(sc, &resblks, &bufsize);
+ 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,12 +58,12 @@ xchk_setup_rtsummary(
if (error)
return error;
- error = xchk_trans_alloc(sc, 0);
+ error = xchk_trans_alloc(sc, resblks);
if (error)
return error;
/* Allocate a memory buffer for the summary comparison. */
- sc->buf = kvmalloc(mp->m_sb.sb_blocksize, XCHK_GFP_FLAGS);
+ sc->buf = kvmalloc(bufsize, XCHK_GFP_FLAGS);
if (!sc->buf)
return -ENOMEM;
@@ -74,8 +84,6 @@ xchk_setup_rtsummary(
/* Helper functions to record suminfo words in an xfile. */
-typedef unsigned int xchk_rtsumoff_t;
-
static inline int
xfsum_load(
struct xfs_scrub *sc,
@@ -96,7 +104,7 @@ xfsum_store(
sumoff << XFS_WORDLOG);
}
-static inline int
+inline int
xfsum_copyout(
struct xfs_scrub *sc,
xchk_rtsumoff_t sumoff,