Lines Matching full:sc
55 struct xfs_scrub *sc, in xrep_attempt() argument
61 trace_xrep_attempt(XFS_I(file_inode(sc->file)), sc->sm, error); in xrep_attempt()
63 xchk_ag_btcur_free(&sc->sa); in xrep_attempt()
66 ASSERT(sc->ops->repair); in xrep_attempt()
69 error = sc->ops->repair(sc); in xrep_attempt()
70 trace_xrep_done(XFS_I(file_inode(sc->file)), sc->sm, error); in xrep_attempt()
78 sc->sm->sm_flags &= ~XFS_SCRUB_FLAGS_OUT; in xrep_attempt()
79 sc->flags |= XREP_ALREADY_FIXED; in xrep_attempt()
83 sc->flags |= XCHK_NEED_DRAIN; in xrep_attempt()
88 if (!(sc->flags & XCHK_TRY_HARDER)) { in xrep_attempt()
89 sc->flags |= XCHK_TRY_HARDER; in xrep_attempt()
132 struct xfs_scrub *sc) in xrep_probe() argument
136 if (xchk_should_terminate(sc, &error)) in xrep_probe()
148 struct xfs_scrub *sc) in xrep_roll_ag_trans() argument
161 if (sc->sa.agi_bp) { in xrep_roll_ag_trans()
162 xfs_ialloc_log_agi(sc->tp, sc->sa.agi_bp, XFS_AGI_MAGICNUM); in xrep_roll_ag_trans()
163 xfs_trans_bhold(sc->tp, sc->sa.agi_bp); in xrep_roll_ag_trans()
166 if (sc->sa.agf_bp) { in xrep_roll_ag_trans()
167 xfs_alloc_log_agf(sc->tp, sc->sa.agf_bp, XFS_AGF_MAGICNUM); in xrep_roll_ag_trans()
168 xfs_trans_bhold(sc->tp, sc->sa.agf_bp); in xrep_roll_ag_trans()
177 error = xfs_trans_roll(&sc->tp); in xrep_roll_ag_trans()
182 if (sc->sa.agi_bp) in xrep_roll_ag_trans()
183 xfs_trans_bjoin(sc->tp, sc->sa.agi_bp); in xrep_roll_ag_trans()
184 if (sc->sa.agf_bp) in xrep_roll_ag_trans()
185 xfs_trans_bjoin(sc->tp, sc->sa.agf_bp); in xrep_roll_ag_trans()
193 struct xfs_scrub *sc) in xrep_roll_trans() argument
195 if (!sc->ip) in xrep_roll_trans()
196 return xrep_roll_ag_trans(sc); in xrep_roll_trans()
197 return xfs_trans_roll_inode(&sc->tp, sc->ip); in xrep_roll_trans()
203 struct xfs_scrub *sc) in xrep_defer_finish() argument
216 if (sc->sa.agi_bp) { in xrep_defer_finish()
217 xfs_ialloc_log_agi(sc->tp, sc->sa.agi_bp, XFS_AGI_MAGICNUM); in xrep_defer_finish()
218 xfs_trans_bhold(sc->tp, sc->sa.agi_bp); in xrep_defer_finish()
221 if (sc->sa.agf_bp) { in xrep_defer_finish()
222 xfs_alloc_log_agf(sc->tp, sc->sa.agf_bp, XFS_AGF_MAGICNUM); in xrep_defer_finish()
223 xfs_trans_bhold(sc->tp, sc->sa.agf_bp); in xrep_defer_finish()
233 error = xfs_defer_finish(&sc->tp); in xrep_defer_finish()
242 if (sc->sa.agi_bp) in xrep_defer_finish()
243 xfs_trans_bhold_release(sc->tp, sc->sa.agi_bp); in xrep_defer_finish()
244 if (sc->sa.agf_bp) in xrep_defer_finish()
245 xfs_trans_bhold_release(sc->tp, sc->sa.agf_bp); in xrep_defer_finish()
273 struct xfs_scrub *sc) in xrep_calc_ag_resblks() argument
275 struct xfs_mount *mp = sc->mp; in xrep_calc_ag_resblks()
276 struct xfs_scrub_metadata *sm = sc->sm; in xrep_calc_ag_resblks()
410 struct xfs_scrub *sc, in xrep_fix_freelist() argument
415 args.mp = sc->mp; in xrep_fix_freelist()
416 args.tp = sc->tp; in xrep_fix_freelist()
417 args.agno = sc->sa.pag->pag_agno; in xrep_fix_freelist()
419 args.pag = sc->sa.pag; in xrep_fix_freelist()
452 struct xfs_scrub *sc; member
479 struct xfs_mount *mp = ri->sc->mp; in xrep_findroot_block()
486 daddr = XFS_AGB_TO_DADDR(mp, ri->sc->sa.pag->pag_agno, agbno); in xrep_findroot_block()
521 error = xfs_trans_read_buf(mp, ri->sc->tp, mp->m_ddev_targp, daddr, in xrep_findroot_block()
615 trace_xrep_findroot_block(mp, ri->sc->sa.pag->pag_agno, agbno, in xrep_findroot_block()
618 xfs_trans_brelse(ri->sc->tp, bp); in xrep_findroot_block()
664 struct xfs_scrub *sc, in xrep_find_ag_btree_roots() argument
669 struct xfs_mount *mp = sc->mp; in xrep_find_ag_btree_roots()
678 ri.sc = sc; in xrep_find_ag_btree_roots()
689 cur = xfs_rmapbt_init_cursor(mp, sc->tp, agf_bp, sc->sa.pag); in xrep_find_ag_btree_roots()
700 struct xfs_scrub *sc, in xrep_update_qflags() argument
704 struct xfs_mount *mp = sc->mp; in xrep_update_qflags()
726 bp = xfs_trans_getsb(sc->tp); in xrep_update_qflags()
728 xfs_trans_buf_set_type(sc->tp, bp, XFS_BLFT_SB_BUF); in xrep_update_qflags()
729 xfs_trans_log_buf(sc->tp, bp, 0, sizeof(struct xfs_dsb) - 1); in xrep_update_qflags()
738 struct xfs_scrub *sc, in xrep_force_quotacheck() argument
744 if (!(flag & sc->mp->m_qflags)) in xrep_force_quotacheck()
747 xrep_update_qflags(sc, flag, 0); in xrep_force_quotacheck()
762 struct xfs_scrub *sc) in xrep_ino_dqattach() argument
766 ASSERT(sc->tp != NULL); in xrep_ino_dqattach()
767 ASSERT(sc->ip != NULL); in xrep_ino_dqattach()
769 error = xfs_qm_dqattach(sc->ip); in xrep_ino_dqattach()
774 xfs_err_ratelimited(sc->mp, in xrep_ino_dqattach()
776 (unsigned long long)sc->ip->i_ino, error); in xrep_ino_dqattach()
777 if (XFS_IS_UQUOTA_ON(sc->mp) && !sc->ip->i_udquot) in xrep_ino_dqattach()
778 xrep_force_quotacheck(sc, XFS_DQTYPE_USER); in xrep_ino_dqattach()
779 if (XFS_IS_GQUOTA_ON(sc->mp) && !sc->ip->i_gdquot) in xrep_ino_dqattach()
780 xrep_force_quotacheck(sc, XFS_DQTYPE_GROUP); in xrep_ino_dqattach()
781 if (XFS_IS_PQUOTA_ON(sc->mp) && !sc->ip->i_pdquot) in xrep_ino_dqattach()
782 xrep_force_quotacheck(sc, XFS_DQTYPE_PROJ); in xrep_ino_dqattach()
802 struct xfs_scrub *sc, in xrep_ino_ensure_extent_count() argument
809 inode_has_nrext64 = xfs_inode_has_large_extent_counts(sc->ip); in xrep_ino_ensure_extent_count()
815 if (!xfs_has_large_extent_counts(sc->mp)) in xrep_ino_ensure_extent_count()
822 sc->ip->i_diflags2 |= XFS_DIFLAG2_NREXT64; in xrep_ino_ensure_extent_count()
823 xfs_trans_log_inode(sc->tp, sc->ip, XFS_ILOG_CORE); in xrep_ino_ensure_extent_count()
833 struct xfs_scrub *sc, in xrep_ag_btcur_init() argument
836 struct xfs_mount *mp = sc->mp; in xrep_ag_btcur_init()
839 if (sc->sm->sm_type != XFS_SCRUB_TYPE_BNOBT && in xrep_ag_btcur_init()
840 sc->sm->sm_type != XFS_SCRUB_TYPE_CNTBT) { in xrep_ag_btcur_init()
841 sa->bno_cur = xfs_bnobt_init_cursor(mp, sc->tp, sa->agf_bp, in xrep_ag_btcur_init()
842 sc->sa.pag); in xrep_ag_btcur_init()
843 sa->cnt_cur = xfs_cntbt_init_cursor(mp, sc->tp, sa->agf_bp, in xrep_ag_btcur_init()
844 sc->sa.pag); in xrep_ag_btcur_init()
848 if (sc->sm->sm_type != XFS_SCRUB_TYPE_INOBT && in xrep_ag_btcur_init()
849 sc->sm->sm_type != XFS_SCRUB_TYPE_FINOBT) { in xrep_ag_btcur_init()
850 sa->ino_cur = xfs_inobt_init_cursor(sc->sa.pag, sc->tp, in xrep_ag_btcur_init()
853 sa->fino_cur = xfs_finobt_init_cursor(sc->sa.pag, in xrep_ag_btcur_init()
854 sc->tp, sa->agi_bp); in xrep_ag_btcur_init()
858 if (sc->sm->sm_type != XFS_SCRUB_TYPE_RMAPBT && in xrep_ag_btcur_init()
860 sa->rmap_cur = xfs_rmapbt_init_cursor(mp, sc->tp, sa->agf_bp, in xrep_ag_btcur_init()
861 sc->sa.pag); in xrep_ag_btcur_init()
864 if (sc->sm->sm_type != XFS_SCRUB_TYPE_REFCNTBT && in xrep_ag_btcur_init()
866 sa->refc_cur = xfs_refcountbt_init_cursor(mp, sc->tp, in xrep_ag_btcur_init()
867 sa->agf_bp, sc->sa.pag); in xrep_ag_btcur_init()
877 struct xfs_scrub *sc) in xrep_reinit_pagf() argument
879 struct xfs_perag *pag = sc->sa.pag; in xrep_reinit_pagf()
887 error = xfs_alloc_read_agf(pag, sc->tp, 0, &bp); in xrep_reinit_pagf()
891 if (bp != sc->sa.agf_bp) { in xrep_reinit_pagf()
892 ASSERT(bp == sc->sa.agf_bp); in xrep_reinit_pagf()
906 struct xfs_scrub *sc) in xrep_reinit_pagi() argument
908 struct xfs_perag *pag = sc->sa.pag; in xrep_reinit_pagi()
916 error = xfs_ialloc_read_agi(pag, sc->tp, 0, &bp); in xrep_reinit_pagi()
920 if (bp != sc->sa.agi_bp) { in xrep_reinit_pagi()
921 ASSERT(bp == sc->sa.agi_bp); in xrep_reinit_pagi()
934 struct xfs_scrub *sc, in xrep_ag_init() argument
942 error = xfs_ialloc_read_agi(pag, sc->tp, 0, &sa->agi_bp); in xrep_ag_init()
946 error = xfs_alloc_read_agf(pag, sc->tp, 0, &sa->agf_bp); in xrep_ag_init()
952 xrep_ag_btcur_init(sc, sa); in xrep_ag_init()
959 struct xfs_scrub *sc) in xrep_reset_perag_resv() argument
963 if (!(sc->flags & XREP_RESET_PERAG_RESV)) in xrep_reset_perag_resv()
966 ASSERT(sc->sa.pag != NULL); in xrep_reset_perag_resv()
967 ASSERT(sc->ops->type == ST_PERAG); in xrep_reset_perag_resv()
968 ASSERT(sc->tp); in xrep_reset_perag_resv()
970 sc->flags &= ~XREP_RESET_PERAG_RESV; in xrep_reset_perag_resv()
971 xfs_ag_resv_free(sc->sa.pag); in xrep_reset_perag_resv()
972 error = xfs_ag_resv_init(sc->sa.pag, sc->tp); in xrep_reset_perag_resv()
974 xfs_err(sc->mp, in xrep_reset_perag_resv()
976 sc->sa.pag->pag_agno); in xrep_reset_perag_resv()
986 struct xfs_scrub *sc) in xrep_will_attempt() argument
989 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_FORCE_REBUILD) in xrep_will_attempt()
993 if (XFS_TEST_ERROR(false, sc->mp, XFS_ERRTAG_FORCE_SCRUB_REPAIR)) in xrep_will_attempt()
997 if (xchk_needs_repair(sc->sm)) in xrep_will_attempt()
1006 struct xfs_scrub *sc, in xrep_metadata_inode_subtype() argument
1018 sub = xchk_scrub_create_subord(sc, scrub_type); in xrep_metadata_inode_subtype()
1019 error = sub->sc.ops->scrub(&sub->sc); in xrep_metadata_inode_subtype()
1022 if (!xrep_will_attempt(&sub->sc)) in xrep_metadata_inode_subtype()
1029 error = sub->sc.ops->repair(&sub->sc); in xrep_metadata_inode_subtype()
1038 error = xfs_defer_finish(&sub->sc.tp); in xrep_metadata_inode_subtype()
1041 error = xfs_trans_roll(&sub->sc.tp); in xrep_metadata_inode_subtype()
1049 sub->sc.sm->sm_flags &= ~XFS_SCRUB_FLAGS_OUT; in xrep_metadata_inode_subtype()
1050 error = sub->sc.ops->scrub(&sub->sc); in xrep_metadata_inode_subtype()
1055 if (xchk_needs_repair(sub->sc.sm)) { in xrep_metadata_inode_subtype()
1066 * sc->ip points to the metadata inode and the ILOCK is held on that inode.
1072 struct xfs_scrub *sc) in xrep_metadata_inode_forks() argument
1078 error = xrep_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_INODE); in xrep_metadata_inode_forks()
1082 error = xrep_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_BMBTD); in xrep_metadata_inode_forks()
1087 if (xfs_inode_hasattr(sc->ip)) { in xrep_metadata_inode_forks()
1088 error = xrep_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_BMBTA); in xrep_metadata_inode_forks()
1094 if (xfs_is_reflink_inode(sc->ip)) { in xrep_metadata_inode_forks()
1096 xfs_trans_ijoin(sc->tp, sc->ip, 0); in xrep_metadata_inode_forks()
1097 error = xfs_reflink_clear_inode_flag(sc->ip, &sc->tp); in xrep_metadata_inode_forks()
1103 if (xfs_inode_hasattr(sc->ip)) { in xrep_metadata_inode_forks()
1106 xfs_trans_ijoin(sc->tp, sc->ip, 0); in xrep_metadata_inode_forks()
1108 error = xrep_xattr_reset_fork(sc); in xrep_metadata_inode_forks()
1118 error = xfs_trans_roll(&sc->tp); in xrep_metadata_inode_forks()
1135 struct xfs_scrub *sc, in xrep_setup_xfbtree() argument
1138 ASSERT(sc->tp == NULL); in xrep_setup_xfbtree()
1140 return xmbuf_alloc(sc->mp, descr, &sc->xmbtp); in xrep_setup_xfbtree()