Lines Matching +full:clear +full:- +full:mask
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2019-2023 Oracle. All Rights Reserved.
21 * Scrub and In-Core Filesystem Health Assessments
26 * cross-reference records between data structures. Therefore, scrub is in a
40 * 3. If the scrubber finds that A is clean, use sick_mask to clear the incore
51 * 6. If repair rebuilds A correctly and the subsequent re-scrub of A is clean,
52 * use sick_mask to clear the incore sick flags. This should have the effect
55 * 7. If repair rebuilds A incorrectly, the re-scrub will find it corrupt and
67 * of 5-7 still apply, but with a sick_mask that covers everything being
71 /* Map our scrub type to a sick mask and a set of health update functions. */
121 /* Return the health status mask for this scrub type. */
130 * If the scrub state is clean, add @mask to the scrub sick mask to clear
136 unsigned int mask) in xchk_mark_healthy_if_clean() argument
138 if (!(sc->sm->sm_flags & (XFS_SCRUB_OFLAG_CORRUPT | in xchk_mark_healthy_if_clean()
140 sc->healthy_mask |= mask; in xchk_mark_healthy_if_clean()
151 unsigned int mask) in xchk_file_looks_zapped() argument
153 ASSERT((mask & ~XFS_SICK_INO_ZAPPED) == 0); in xchk_file_looks_zapped()
155 if (sc->flags & XREP_ALREADY_FIXED) in xchk_file_looks_zapped()
158 return xfs_inode_has_sickness(sc->ip, mask); in xchk_file_looks_zapped()
162 * Scrub gave the filesystem a clean bill of health, so clear all the indirect
196 unsigned int mask = sc->sick_mask; in xchk_update_health() local
200 * The HEALTHY scrub type is a request from userspace to clear all the in xchk_update_health()
203 * mask check. in xchk_update_health()
205 if (sc->sm->sm_type == XFS_SCRUB_TYPE_HEALTHY && in xchk_update_health()
206 !(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) { in xchk_update_health()
207 xchk_mark_all_healthy(sc->mp); in xchk_update_health()
211 bad = (sc->sm->sm_flags & (XFS_SCRUB_OFLAG_CORRUPT | in xchk_update_health()
214 mask |= sc->healthy_mask; in xchk_update_health()
215 switch (type_to_health_flag[sc->sm->sm_type].group) { in xchk_update_health()
219 if (!mask) in xchk_update_health()
221 pag = xfs_perag_get(sc->mp, sc->sm->sm_agno); in xchk_update_health()
223 xfs_group_mark_corrupt(pag_group(pag), mask); in xchk_update_health()
225 xfs_group_mark_healthy(pag_group(pag), mask); in xchk_update_health()
229 if (!sc->ip) in xchk_update_health()
236 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) in xchk_update_health()
237 mask |= XFS_SICK_INO_FORGET; in xchk_update_health()
238 if (!mask) in xchk_update_health()
241 xfs_inode_mark_corrupt(sc->ip, mask); in xchk_update_health()
243 xfs_inode_mark_healthy(sc->ip, mask); in xchk_update_health()
246 if (!mask) in xchk_update_health()
249 xfs_fs_mark_corrupt(sc->mp, mask); in xchk_update_health()
251 xfs_fs_mark_healthy(sc->mp, mask); in xchk_update_health()
254 if (!mask) in xchk_update_health()
256 rtg = xfs_rtgroup_get(sc->mp, sc->sm->sm_agno); in xchk_update_health()
258 xfs_group_mark_corrupt(rtg_group(rtg), mask); in xchk_update_health()
260 xfs_group_mark_healthy(rtg_group(rtg), mask); in xchk_update_health()
269 /* Is the given per-AG btree healthy enough for scanning? */
276 unsigned int mask = (*curp)->bc_ops->sick_mask; in xchk_ag_btree_del_cursor_if_sick() local
282 * Otherwise, we're only interested in the btree for cross-referencing. in xchk_ag_btree_del_cursor_if_sick()
285 if (sc->sm->sm_type == sm_type) in xchk_ag_btree_del_cursor_if_sick()
289 * If we just repaired some AG metadata, sc->sick_mask will reflect all in xchk_ag_btree_del_cursor_if_sick()
290 * the per-AG metadata types that were repaired. Exclude these from in xchk_ag_btree_del_cursor_if_sick()
294 if ((sc->flags & XREP_ALREADY_FIXED) && in xchk_ag_btree_del_cursor_if_sick()
295 type_to_health_flag[sc->sm->sm_type].group == XHG_AG) in xchk_ag_btree_del_cursor_if_sick()
296 mask &= ~sc->sick_mask; in xchk_ag_btree_del_cursor_if_sick()
298 if (xfs_group_has_sickness((*curp)->bc_group, mask)) { in xchk_ag_btree_del_cursor_if_sick()
299 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL; in xchk_ag_btree_del_cursor_if_sick()
306 * Quick scan to double-check that there isn't any evidence of lingering
307 * primary health problems. If we're still clear, then the health update will
314 struct xfs_mount *mp = sc->mp; in xchk_health_record()