Lines Matching defs:sc

138 	struct xfs_scrub	*sc)
142 if (xchk_should_terminate(sc, &error))
152 struct xfs_scrub *sc)
154 if (!(sc->flags & XCHK_FSGATES_ALL))
157 trace_xchk_fsgates_disable(sc, sc->flags & XCHK_FSGATES_ALL);
159 if (sc->flags & XCHK_FSGATES_DRAIN)
162 if (sc->flags & XCHK_FSGATES_QUOTA)
165 if (sc->flags & XCHK_FSGATES_DIRENTS)
168 if (sc->flags & XCHK_FSGATES_RMAP)
171 sc->flags &= ~XCHK_FSGATES_ALL;
177 struct xfs_scrub *sc,
180 xchk_ag_free(sc, &sc->sa);
181 if (sc->tp) {
182 if (error == 0 && (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR))
183 error = xfs_trans_commit(sc->tp);
185 xfs_trans_cancel(sc->tp);
186 sc->tp = NULL;
188 if (sc->ip) {
189 if (sc->ilock_flags)
190 xchk_iunlock(sc, sc->ilock_flags);
191 xchk_irele(sc, sc->ip);
192 sc->ip = NULL;
194 if (sc->flags & XCHK_HAVE_FREEZE_PROT) {
195 sc->flags &= ~XCHK_HAVE_FREEZE_PROT;
196 mnt_drop_write_file(sc->file);
198 if (sc->xmbtp) {
199 xmbuf_free(sc->xmbtp);
200 sc->xmbtp = NULL;
202 if (sc->xfile) {
203 xfile_destroy(sc->xfile);
204 sc->xfile = NULL;
206 if (sc->buf) {
207 if (sc->buf_cleanup)
208 sc->buf_cleanup(sc->buf);
209 kvfree(sc->buf);
210 sc->buf_cleanup = NULL;
211 sc->buf = NULL;
214 xchk_fsgates_disable(sc);
474 static inline void xchk_postmortem(struct xfs_scrub *sc)
481 if ((sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) &&
482 (sc->sm->sm_flags & (XFS_SCRUB_OFLAG_CORRUPT |
484 xrep_failure(sc->mp);
487 static inline void xchk_postmortem(struct xfs_scrub *sc)
493 if (sc->sm->sm_flags & (XFS_SCRUB_OFLAG_CORRUPT |
495 xfs_alert_ratelimited(sc->mp,
507 struct xfs_scrub *sc;
532 sc = kzalloc(sizeof(struct xfs_scrub), XCHK_GFP_FLAGS);
533 if (!sc) {
538 sc->mp = mp;
539 sc->file = file;
540 sc->sm = sm;
541 sc->ops = &meta_scrub_ops[sm->sm_type];
542 sc->sick_mask = xchk_health_mask_for_scrub_type(sm->sm_type);
549 error = mnt_want_write_file(sc->file);
553 sc->flags |= XCHK_HAVE_FREEZE_PROT;
557 error = sc->ops->setup(sc);
558 if (error == -EDEADLOCK && !(sc->flags & XCHK_TRY_HARDER))
560 if (error == -ECHRNG && !(sc->flags & XCHK_NEED_DRAIN))
567 if ((sc->flags & XREP_ALREADY_FIXED) && sc->ops->repair_eval != NULL)
568 error = sc->ops->repair_eval(sc);
570 error = sc->ops->scrub(sc);
572 if (error == -EDEADLOCK && !(sc->flags & XCHK_TRY_HARDER))
574 if (error == -ECHRNG && !(sc->flags & XCHK_NEED_DRAIN))
579 xchk_update_health(sc);
581 if (xchk_could_repair(sc)) {
586 if (!xrep_will_attempt(sc)) {
587 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED;
595 error = xrep_attempt(sc, &run);
602 error = xchk_teardown(sc, 0);
612 xchk_postmortem(sc);
614 error = xchk_teardown(sc, error);
618 kfree(sc);
627 error = xchk_teardown(sc, 0);
630 sc->flags |= XCHK_NEED_DRAIN;
639 error = xchk_teardown(sc, 0);
642 sc->flags |= XCHK_TRY_HARDER;