Lines Matching refs:sc

71 	struct xfs_scrub	*sc)  in xchk_fscount_warmup()  argument
73 struct xfs_mount *mp = sc->mp; in xchk_fscount_warmup()
81 if (xchk_should_terminate(sc, &error)) in xchk_fscount_warmup()
88 error = xfs_ialloc_read_agi(pag, sc->tp, 0, &agi_bp); in xchk_fscount_warmup()
91 error = xfs_alloc_read_agf(pag, sc->tp, 0, &agf_bp); in xchk_fscount_warmup()
122 struct xfs_scrub *sc) in xchk_fsfreeze() argument
126 error = freeze_super(sc->mp->m_super, FREEZE_HOLDER_KERNEL); in xchk_fsfreeze()
127 trace_xchk_fsfreeze(sc, error); in xchk_fsfreeze()
133 struct xfs_scrub *sc) in xchk_fsthaw() argument
138 error = thaw_super(sc->mp->m_super, FREEZE_HOLDER_KERNEL); in xchk_fsthaw()
139 trace_xchk_fsthaw(sc, error); in xchk_fsthaw()
153 struct xfs_scrub *sc) in xchk_fscounters_freeze() argument
155 struct xchk_fscounters *fsc = sc->buf; in xchk_fscounters_freeze()
158 if (sc->flags & XCHK_HAVE_FREEZE_PROT) { in xchk_fscounters_freeze()
159 sc->flags &= ~XCHK_HAVE_FREEZE_PROT; in xchk_fscounters_freeze()
160 mnt_drop_write_file(sc->file); in xchk_fscounters_freeze()
164 while ((error = xchk_fsfreeze(sc)) == -EBUSY) { in xchk_fscounters_freeze()
165 if (xchk_should_terminate(sc, &error)) in xchk_fscounters_freeze()
183 struct xfs_scrub *sc = fsc->sc; in xchk_fscounters_cleanup() local
189 error = xchk_fsthaw(sc); in xchk_fscounters_cleanup()
191 xfs_emerg(sc->mp, "still frozen after scrub, err=%d", error); in xchk_fscounters_cleanup()
198 struct xfs_scrub *sc) in xchk_setup_fscounters() argument
207 if (!xfs_has_lazysbcount(sc->mp)) in xchk_setup_fscounters()
208 xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN); in xchk_setup_fscounters()
210 sc->buf = kzalloc(sizeof(struct xchk_fscounters), XCHK_GFP_FLAGS); in xchk_setup_fscounters()
211 if (!sc->buf) in xchk_setup_fscounters()
213 sc->buf_cleanup = xchk_fscounters_cleanup; in xchk_setup_fscounters()
214 fsc = sc->buf; in xchk_setup_fscounters()
215 fsc->sc = sc; in xchk_setup_fscounters()
217 xfs_icount_range(sc->mp, &fsc->icount_min, &fsc->icount_max); in xchk_setup_fscounters()
220 error = xchk_fscount_warmup(sc); in xchk_setup_fscounters()
234 if ((sc->flags & XCHK_TRY_HARDER) || xchk_could_repair(sc)) { in xchk_setup_fscounters()
235 error = xchk_fscounters_freeze(sc); in xchk_setup_fscounters()
240 return xchk_trans_alloc_empty(sc); in xchk_setup_fscounters()
260 struct xfs_scrub *sc, in xchk_fscount_btreeblks() argument
267 error = xchk_ag_init_existing(sc, agno, &sc->sa); in xchk_fscount_btreeblks()
271 error = xfs_btree_count_blocks(sc->sa.bno_cur, &blocks); in xchk_fscount_btreeblks()
276 error = xfs_btree_count_blocks(sc->sa.cnt_cur, &blocks); in xchk_fscount_btreeblks()
282 xchk_ag_free(sc, &sc->sa); in xchk_fscount_btreeblks()
294 struct xfs_scrub *sc, in xchk_fscount_aggregate_agcounts() argument
297 struct xfs_mount *mp = sc->mp; in xchk_fscount_aggregate_agcounts()
310 if (xchk_should_terminate(sc, &error)) in xchk_fscount_aggregate_agcounts()
327 if (xfs_has_lazysbcount(sc->mp)) { in xchk_fscount_aggregate_agcounts()
330 error = xchk_fscount_btreeblks(sc, fsc, agno); in xchk_fscount_aggregate_agcounts()
346 xchk_set_incomplete(sc); in xchk_fscount_aggregate_agcounts()
401 xchk_should_terminate(fsc->sc, &error); in xchk_fscount_add_frextent()
408 struct xfs_scrub *sc, in xchk_fscount_count_frextents() argument
411 struct xfs_mount *mp = sc->mp; in xchk_fscount_count_frextents()
419 xfs_rtbitmap_lock_shared(sc->mp, XFS_RBMLOCK_BITMAP); in xchk_fscount_count_frextents()
420 error = xfs_rtalloc_query_all(sc->mp, sc->tp, in xchk_fscount_count_frextents()
423 xchk_set_incomplete(sc); in xchk_fscount_count_frextents()
430 xfs_rtbitmap_unlock_shared(sc->mp, XFS_RBMLOCK_BITMAP); in xchk_fscount_count_frextents()
436 struct xfs_scrub *sc, in xchk_fscount_count_frextents() argument
467 struct xfs_scrub *sc, in xchk_fscount_within_range() argument
475 trace_xchk_fscounters_within_range(sc->mp, expected, curr_value, in xchk_fscount_within_range()
487 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) in xchk_fscount_within_range()
504 struct xfs_scrub *sc) in xchk_fscounters() argument
506 struct xfs_mount *mp = sc->mp; in xchk_fscounters()
507 struct xchk_fscounters *fsc = sc->buf; in xchk_fscounters()
520 xchk_set_corrupt(sc); in xchk_fscounters()
535 xchk_set_corrupt(sc); in xchk_fscounters()
541 xchk_set_corrupt(sc); in xchk_fscounters()
545 xchk_set_corrupt(sc); in xchk_fscounters()
549 xchk_set_corrupt(sc); in xchk_fscounters()
556 xchk_set_corrupt(sc); in xchk_fscounters()
559 error = xchk_fscount_aggregate_agcounts(sc, fsc); in xchk_fscounters()
560 if (!xchk_process_error(sc, 0, XFS_SB_BLOCK(mp), &error)) in xchk_fscounters()
564 error = xchk_fscount_count_frextents(sc, fsc); in xchk_fscounters()
565 if (!xchk_process_error(sc, 0, XFS_SB_BLOCK(mp), &error)) in xchk_fscounters()
567 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_INCOMPLETE) in xchk_fscounters()
576 if (!xchk_fscount_within_range(sc, icount, &mp->m_icount, in xchk_fscounters()
579 xchk_set_corrupt(sc); in xchk_fscounters()
584 if (!xchk_fscount_within_range(sc, ifree, &mp->m_ifree, fsc->ifree)) { in xchk_fscounters()
586 xchk_set_corrupt(sc); in xchk_fscounters()
591 if (!xchk_fscount_within_range(sc, fdblocks, &mp->m_fdblocks, in xchk_fscounters()
594 xchk_set_corrupt(sc); in xchk_fscounters()
599 if (!xchk_fscount_within_range(sc, frextents, &mp->m_frextents, in xchk_fscounters()
602 xchk_set_corrupt(sc); in xchk_fscounters()