diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-14 11:06:53 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-11-09 19:07:41 -0800 |
commit | 6f8e90c16688581aeff379d2c3370dc57b0237c4 (patch) | |
tree | 72aa4520dcc2e9a93dce144b9aaec38ada9243c6 /fs/xfs/scrub/rtsummary.c | |
parent | 85bb2302750fc8105aff6488d554c950db57c073 (diff) |
xfs: online repair of realtime summariesrepair-rtsummary_2022-11-09
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.c | 18 |
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, |