• Home
  • Raw
  • Download

Lines Matching +full:scrubber +full:- +full:done

1 // SPDX-License-Identifier: GPL-2.0+
28 /* Reference count btree scrubber. */
47 * need to find ($refcount - $seen) owners for every block in the
103 if (xchk_should_terminate(refchk->sc, &error)) in xchk_refcountbt_rmap_check()
106 rm_last = rec->rm_startblock + rec->rm_blockcount - 1; in xchk_refcountbt_rmap_check()
107 rc_last = refchk->bno + refchk->len - 1; in xchk_refcountbt_rmap_check()
109 /* Confirm that a single-owner refc extent is a CoW stage. */ in xchk_refcountbt_rmap_check()
110 if (refchk->refcount == 1 && rec->rm_owner != XFS_RMAP_OWN_COW) { in xchk_refcountbt_rmap_check()
111 xchk_btree_xref_set_corrupt(refchk->sc, cur, 0); in xchk_refcountbt_rmap_check()
115 if (rec->rm_startblock <= refchk->bno && rm_last >= rc_last) { in xchk_refcountbt_rmap_check()
120 refchk->seen++; in xchk_refcountbt_rmap_check()
131 return -ENOMEM; in xchk_refcountbt_rmap_check()
132 memcpy(&frag->rm, rec, sizeof(frag->rm)); in xchk_refcountbt_rmap_check()
133 list_add_tail(&frag->list, &refchk->fragments); in xchk_refcountbt_rmap_check()
159 target_nr = refchk->refcount - refchk->seen; in xchk_refcountbt_process_rmap_fragments()
164 * There are (refchk->rc.rc_refcount - refchk->nr refcount) in xchk_refcountbt_process_rmap_fragments()
176 list_for_each_entry(frag, &refchk->fragments, list) { in xchk_refcountbt_process_rmap_fragments()
177 if (frag->rm.rm_startblock < bno) in xchk_refcountbt_process_rmap_fragments()
178 goto done; in xchk_refcountbt_process_rmap_fragments()
179 bno = frag->rm.rm_startblock; in xchk_refcountbt_process_rmap_fragments()
187 list_for_each_entry_safe(frag, n, &refchk->fragments, list) { in xchk_refcountbt_process_rmap_fragments()
188 if (frag->rm.rm_startblock > refchk->bno || nr > target_nr) in xchk_refcountbt_process_rmap_fragments()
190 bno = frag->rm.rm_startblock + frag->rm.rm_blockcount; in xchk_refcountbt_process_rmap_fragments()
193 list_move_tail(&frag->list, &worklist); in xchk_refcountbt_process_rmap_fragments()
202 goto done; in xchk_refcountbt_process_rmap_fragments()
204 while (!list_empty(&refchk->fragments)) { in xchk_refcountbt_process_rmap_fragments()
209 bno = frag->rm.rm_startblock + frag->rm.rm_blockcount; in xchk_refcountbt_process_rmap_fragments()
215 list_del(&frag->list); in xchk_refcountbt_process_rmap_fragments()
221 list_for_each_entry_safe(frag, n, &refchk->fragments, list) { in xchk_refcountbt_process_rmap_fragments()
222 bno = frag->rm.rm_startblock + frag->rm.rm_blockcount; in xchk_refcountbt_process_rmap_fragments()
223 if (frag->rm.rm_startblock != rbno) in xchk_refcountbt_process_rmap_fragments()
224 goto done; in xchk_refcountbt_process_rmap_fragments()
225 list_move_tail(&frag->list, &worklist); in xchk_refcountbt_process_rmap_fragments()
228 nr--; in xchk_refcountbt_process_rmap_fragments()
237 * required refcount. Something is wrong, so we're done. in xchk_refcountbt_process_rmap_fragments()
240 goto done; in xchk_refcountbt_process_rmap_fragments()
249 if (rbno < refchk->bno + refchk->len) in xchk_refcountbt_process_rmap_fragments()
250 goto done; in xchk_refcountbt_process_rmap_fragments()
253 refchk->seen = refchk->refcount; in xchk_refcountbt_process_rmap_fragments()
254 done: in xchk_refcountbt_process_rmap_fragments()
257 list_del(&frag->list); in xchk_refcountbt_process_rmap_fragments()
260 list_for_each_entry_safe(frag, n, &refchk->fragments, list) { in xchk_refcountbt_process_rmap_fragments()
261 list_del(&frag->list); in xchk_refcountbt_process_rmap_fragments()
287 if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) in xchk_refcountbt_xref_rmap()
290 /* Cross-reference with the rmapbt to confirm the refcount. */ in xchk_refcountbt_xref_rmap()
294 high.rm_startblock = bno + len - 1; in xchk_refcountbt_xref_rmap()
297 error = xfs_rmap_query_range(sc->sa.rmap_cur, &low, &high, in xchk_refcountbt_xref_rmap()
299 if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur)) in xchk_refcountbt_xref_rmap()
304 xchk_btree_xref_set_corrupt(sc, sc->sa.rmap_cur, 0); in xchk_refcountbt_xref_rmap()
308 list_del(&frag->list); in xchk_refcountbt_xref_rmap()
313 /* Cross-reference with the other btrees. */
321 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_refcountbt_xref()
335 struct xfs_mount *mp = bs->cur->bc_mp; in xchk_refcountbt_rec()
336 xfs_agblock_t *cow_blocks = bs->private; in xchk_refcountbt_rec()
337 xfs_agnumber_t agno = bs->cur->bc_ag.agno; in xchk_refcountbt_rec()
343 bno = be32_to_cpu(rec->refc.rc_startblock); in xchk_refcountbt_rec()
344 len = be32_to_cpu(rec->refc.rc_blockcount); in xchk_refcountbt_rec()
345 refcount = be32_to_cpu(rec->refc.rc_refcount); in xchk_refcountbt_rec()
350 xchk_btree_set_corrupt(bs->sc, bs->cur, 0); in xchk_refcountbt_rec()
358 !xfs_verify_agbno(mp, agno, bno + len - 1)) in xchk_refcountbt_rec()
359 xchk_btree_set_corrupt(bs->sc, bs->cur, 0); in xchk_refcountbt_rec()
362 xchk_btree_set_corrupt(bs->sc, bs->cur, 0); in xchk_refcountbt_rec()
364 xchk_refcountbt_xref(bs->sc, bno, len, refcount); in xchk_refcountbt_rec()
379 if (!sc->sa.rmap_cur || xchk_skip_xref(sc->sm)) in xchk_refcount_xref_rmap()
383 error = xfs_btree_count_blocks(sc->sa.refc_cur, &refcbt_blocks); in xchk_refcount_xref_rmap()
384 if (!xchk_btree_process_error(sc, sc->sa.refc_cur, 0, &error)) in xchk_refcount_xref_rmap()
386 error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, in xchk_refcount_xref_rmap()
388 if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur)) in xchk_refcount_xref_rmap()
391 xchk_btree_xref_set_corrupt(sc, sc->sa.rmap_cur, 0); in xchk_refcount_xref_rmap()
394 error = xchk_count_rmap_ownedby_ag(sc, sc->sa.rmap_cur, in xchk_refcount_xref_rmap()
396 if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur)) in xchk_refcount_xref_rmap()
399 xchk_btree_xref_set_corrupt(sc, sc->sa.rmap_cur, 0); in xchk_refcount_xref_rmap()
410 error = xchk_btree(sc, sc->sa.refc_cur, xchk_refcountbt_rec, in xchk_refcountbt()
432 if (!sc->sa.refc_cur || xchk_skip_xref(sc->sm)) in xchk_xref_is_cow_staging()
436 error = xfs_refcount_lookup_le(sc->sa.refc_cur, in xchk_xref_is_cow_staging()
438 if (!xchk_should_check_xref(sc, &error, &sc->sa.refc_cur)) in xchk_xref_is_cow_staging()
441 xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0); in xchk_xref_is_cow_staging()
445 error = xfs_refcount_get_rec(sc->sa.refc_cur, &rc, &has_refcount); in xchk_xref_is_cow_staging()
446 if (!xchk_should_check_xref(sc, &error, &sc->sa.refc_cur)) in xchk_xref_is_cow_staging()
449 xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0); in xchk_xref_is_cow_staging()
456 xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0); in xchk_xref_is_cow_staging()
460 xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0); in xchk_xref_is_cow_staging()
476 if (!sc->sa.refc_cur || xchk_skip_xref(sc->sm)) in xchk_xref_is_not_shared()
479 error = xfs_refcount_has_record(sc->sa.refc_cur, agbno, len, &shared); in xchk_xref_is_not_shared()
480 if (!xchk_should_check_xref(sc, &error, &sc->sa.refc_cur)) in xchk_xref_is_not_shared()
483 xchk_btree_xref_set_corrupt(sc, sc->sa.refc_cur, 0); in xchk_xref_is_not_shared()