Lines Matching refs:sc
52 struct xfs_scrub *sc; member
81 struct xfs_scrub *sc) in xchk_fscount_warmup() argument
83 struct xfs_mount *mp = sc->mp; in xchk_fscount_warmup()
91 if (xchk_should_terminate(sc, &error)) in xchk_fscount_warmup()
98 error = xfs_ialloc_read_agi(pag, sc->tp, &agi_bp); in xchk_fscount_warmup()
101 error = xfs_alloc_read_agf(pag, sc->tp, 0, &agf_bp); in xchk_fscount_warmup()
132 struct xfs_scrub *sc) in xchk_fsfreeze() argument
136 error = freeze_super(sc->mp->m_super, FREEZE_HOLDER_KERNEL); in xchk_fsfreeze()
137 trace_xchk_fsfreeze(sc, error); in xchk_fsfreeze()
143 struct xfs_scrub *sc) in xchk_fsthaw() argument
148 error = thaw_super(sc->mp->m_super, FREEZE_HOLDER_KERNEL); in xchk_fsthaw()
149 trace_xchk_fsthaw(sc, error); in xchk_fsthaw()
163 struct xfs_scrub *sc) in xchk_fscounters_freeze() argument
165 struct xchk_fscounters *fsc = sc->buf; in xchk_fscounters_freeze()
168 if (sc->flags & XCHK_HAVE_FREEZE_PROT) { in xchk_fscounters_freeze()
169 sc->flags &= ~XCHK_HAVE_FREEZE_PROT; in xchk_fscounters_freeze()
170 mnt_drop_write_file(sc->file); in xchk_fscounters_freeze()
174 while ((error = xchk_fsfreeze(sc)) == -EBUSY) { in xchk_fscounters_freeze()
175 if (xchk_should_terminate(sc, &error)) in xchk_fscounters_freeze()
193 struct xfs_scrub *sc = fsc->sc; in xchk_fscounters_cleanup() local
199 error = xchk_fsthaw(sc); in xchk_fscounters_cleanup()
201 xfs_emerg(sc->mp, "still frozen after scrub, err=%d", error); in xchk_fscounters_cleanup()
208 struct xfs_scrub *sc) in xchk_setup_fscounters() argument
217 if (!xfs_has_lazysbcount(sc->mp)) in xchk_setup_fscounters()
218 xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN); in xchk_setup_fscounters()
220 sc->buf = kzalloc(sizeof(struct xchk_fscounters), XCHK_GFP_FLAGS); in xchk_setup_fscounters()
221 if (!sc->buf) in xchk_setup_fscounters()
223 sc->buf_cleanup = xchk_fscounters_cleanup; in xchk_setup_fscounters()
224 fsc = sc->buf; in xchk_setup_fscounters()
225 fsc->sc = sc; in xchk_setup_fscounters()
227 xfs_icount_range(sc->mp, &fsc->icount_min, &fsc->icount_max); in xchk_setup_fscounters()
230 error = xchk_fscount_warmup(sc); in xchk_setup_fscounters()
239 if (sc->flags & XCHK_TRY_HARDER) { in xchk_setup_fscounters()
240 error = xchk_fscounters_freeze(sc); in xchk_setup_fscounters()
245 return xfs_trans_alloc_empty(sc->mp, &sc->tp); in xchk_setup_fscounters()
263 struct xfs_scrub *sc, in xchk_fscount_btreeblks() argument
270 error = xchk_ag_init_existing(sc, agno, &sc->sa); in xchk_fscount_btreeblks()
274 error = xfs_btree_count_blocks(sc->sa.bno_cur, &blocks); in xchk_fscount_btreeblks()
279 error = xfs_btree_count_blocks(sc->sa.cnt_cur, &blocks); in xchk_fscount_btreeblks()
285 xchk_ag_free(sc, &sc->sa); in xchk_fscount_btreeblks()
297 struct xfs_scrub *sc, in xchk_fscount_aggregate_agcounts() argument
300 struct xfs_mount *mp = sc->mp; in xchk_fscount_aggregate_agcounts()
313 if (xchk_should_terminate(sc, &error)) in xchk_fscount_aggregate_agcounts()
330 if (xfs_has_lazysbcount(sc->mp)) { in xchk_fscount_aggregate_agcounts()
333 error = xchk_fscount_btreeblks(sc, fsc, agno); in xchk_fscount_aggregate_agcounts()
349 xchk_set_incomplete(sc); in xchk_fscount_aggregate_agcounts()
404 xchk_should_terminate(fsc->sc, &error); in xchk_fscount_add_frextent()
411 struct xfs_scrub *sc, in xchk_fscount_count_frextents() argument
414 struct xfs_mount *mp = sc->mp; in xchk_fscount_count_frextents()
421 xfs_ilock(sc->mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP); in xchk_fscount_count_frextents()
422 error = xfs_rtalloc_query_all(sc->mp, sc->tp, in xchk_fscount_count_frextents()
425 xchk_set_incomplete(sc); in xchk_fscount_count_frextents()
430 xfs_iunlock(sc->mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP); in xchk_fscount_count_frextents()
436 struct xfs_scrub *sc, in xchk_fscount_count_frextents() argument
466 struct xfs_scrub *sc, in xchk_fscount_within_range() argument
474 trace_xchk_fscounters_within_range(sc->mp, expected, curr_value, in xchk_fscount_within_range()
499 struct xfs_scrub *sc) in xchk_fscounters() argument
501 struct xfs_mount *mp = sc->mp; in xchk_fscounters()
502 struct xchk_fscounters *fsc = sc->buf; in xchk_fscounters()
515 xchk_set_corrupt(sc); in xchk_fscounters()
530 xchk_set_corrupt(sc); in xchk_fscounters()
536 xchk_set_corrupt(sc); in xchk_fscounters()
540 xchk_set_corrupt(sc); in xchk_fscounters()
544 xchk_set_corrupt(sc); in xchk_fscounters()
551 xchk_set_corrupt(sc); in xchk_fscounters()
554 error = xchk_fscount_aggregate_agcounts(sc, fsc); in xchk_fscounters()
555 if (!xchk_process_error(sc, 0, XFS_SB_BLOCK(mp), &error)) in xchk_fscounters()
559 error = xchk_fscount_count_frextents(sc, fsc); in xchk_fscounters()
560 if (!xchk_process_error(sc, 0, XFS_SB_BLOCK(mp), &error)) in xchk_fscounters()
562 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_INCOMPLETE) in xchk_fscounters()
571 if (!xchk_fscount_within_range(sc, icount, &mp->m_icount, in xchk_fscounters()
574 xchk_set_corrupt(sc); in xchk_fscounters()
579 if (!xchk_fscount_within_range(sc, ifree, &mp->m_ifree, fsc->ifree)) { in xchk_fscounters()
581 xchk_set_corrupt(sc); in xchk_fscounters()
586 if (!xchk_fscount_within_range(sc, fdblocks, &mp->m_fdblocks, in xchk_fscounters()
589 xchk_set_corrupt(sc); in xchk_fscounters()
594 if (!xchk_fscount_within_range(sc, frextents, &mp->m_frextents, in xchk_fscounters()
597 xchk_set_corrupt(sc); in xchk_fscounters()