health.c (a940daa52167e9db8ecce82213813b735a9d9f23) health.c (d9041681dd2f5334529a68868c9266631c384de4)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (C) 2019-2023 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <djwong@kernel.org>
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 104 unchanged lines hidden (view full) ---

113unsigned int
114xchk_health_mask_for_scrub_type(
115 __u32 scrub_type)
116{
117 return type_to_health_flag[scrub_type].sick_mask;
118}
119
120/*
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Copyright (C) 2019-2023 Oracle. All Rights Reserved.
4 * Author: Darrick J. Wong <djwong@kernel.org>
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_shared.h"

--- 104 unchanged lines hidden (view full) ---

113unsigned int
114xchk_health_mask_for_scrub_type(
115 __u32 scrub_type)
116{
117 return type_to_health_flag[scrub_type].sick_mask;
118}
119
120/*
121 * If the scrub state is clean, add @mask to the scrub sick mask to clear
122 * additional sick flags from the metadata object's sick state.
123 */
124void
125xchk_mark_healthy_if_clean(
126 struct xfs_scrub *sc,
127 unsigned int mask)
128{
129 if (!(sc->sm->sm_flags & (XFS_SCRUB_OFLAG_CORRUPT |
130 XFS_SCRUB_OFLAG_XCORRUPT)))
131 sc->sick_mask |= mask;
132}
133
134/*
135 * If we're scrubbing a piece of file metadata for the first time, does it look
136 * like it has been zapped? Skip the check if we just repaired the metadata
137 * and are revalidating it.
138 */
139bool
140xchk_file_looks_zapped(
141 struct xfs_scrub *sc,
142 unsigned int mask)
143{
144 ASSERT((mask & ~XFS_SICK_INO_ZAPPED) == 0);
145
146 if (sc->flags & XREP_ALREADY_FIXED)
147 return false;
148
149 return xfs_inode_has_sickness(sc->ip, mask);
150}
151
152/*
121 * Update filesystem health assessments based on what we found and did.
122 *
123 * If the scrubber finds errors, we mark sick whatever's mentioned in
124 * sick_mask, no matter whether this is a first scan or an
125 * evaluation of repair effectiveness.
126 *
127 * Otherwise, no direct corruption was found, so mark whatever's in
128 * sick_mask as healthy.

--- 117 unchanged lines hidden ---
153 * Update filesystem health assessments based on what we found and did.
154 *
155 * If the scrubber finds errors, we mark sick whatever's mentioned in
156 * sick_mask, no matter whether this is a first scan or an
157 * evaluation of repair effectiveness.
158 *
159 * Otherwise, no direct corruption was found, so mark whatever's in
160 * sick_mask as healthy.

--- 117 unchanged lines hidden ---