Lines Matching defs:sc

24 	struct xfs_scrub	*sc)
26 if (xchk_need_intent_drain(sc))
27 xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN);
28 return xchk_setup_fs(sc);
36 struct xfs_scrub *sc,
39 struct xfs_mount *mp = sc->mp;
40 xfs_agnumber_t agno = sc->sm->sm_agno;
44 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
49 error = xchk_ag_init_existing(sc, agno, &sc->sa);
50 if (!xchk_xref_process_error(sc, agno, agbno, &error))
53 xchk_xref_is_used_space(sc, agbno, 1);
54 xchk_xref_is_not_inode_chunk(sc, agbno, 1);
55 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS);
56 xchk_xref_is_not_shared(sc, agbno, 1);
57 xchk_xref_is_not_cow_staging(sc, agbno, 1);
59 /* scrub teardown will take care of sc->sa for us */
72 struct xfs_scrub *sc)
74 struct xfs_mount *mp = sc->mp;
84 agno = sc->sm->sm_agno;
97 error = xfs_sb_read_secondary(mp, sc->tp, agno, &bp);
115 if (!xchk_process_error(sc, agno, XFS_SB_BLOCK(mp), &error))
127 xchk_block_set_corrupt(sc, bp);
130 xchk_block_set_corrupt(sc, bp);
133 xchk_block_set_corrupt(sc, bp);
136 xchk_block_set_corrupt(sc, bp);
139 xchk_block_set_preen(sc, bp);
142 xchk_block_set_corrupt(sc, bp);
145 xchk_block_set_preen(sc, bp);
148 xchk_block_set_preen(sc, bp);
151 xchk_block_set_preen(sc, bp);
154 xchk_block_set_corrupt(sc, bp);
157 xchk_block_set_corrupt(sc, bp);
160 xchk_block_set_corrupt(sc, bp);
163 xchk_block_set_corrupt(sc, bp);
166 xchk_block_set_corrupt(sc, bp);
179 xchk_block_set_corrupt(sc, bp);
187 xchk_block_set_preen(sc, bp);
190 xchk_block_set_corrupt(sc, bp);
193 xchk_block_set_corrupt(sc, bp);
196 xchk_block_set_corrupt(sc, bp);
199 xchk_block_set_preen(sc, bp);
202 xchk_block_set_corrupt(sc, bp);
205 xchk_block_set_corrupt(sc, bp);
208 xchk_block_set_corrupt(sc, bp);
211 xchk_block_set_corrupt(sc, bp);
214 xchk_block_set_corrupt(sc, bp);
217 xchk_block_set_corrupt(sc, bp);
220 xchk_block_set_preen(sc, bp);
228 xchk_block_set_preen(sc, bp);
231 xchk_block_set_preen(sc, bp);
239 xchk_block_set_corrupt(sc, bp);
242 xchk_block_set_corrupt(sc, bp);
245 xchk_block_set_corrupt(sc, bp);
248 xchk_block_set_preen(sc, bp);
251 xchk_block_set_preen(sc, bp);
254 xchk_block_set_corrupt(sc, bp);
257 xchk_block_set_corrupt(sc, bp);
260 xchk_block_set_corrupt(sc, bp);
263 xchk_block_set_corrupt(sc, bp);
268 xchk_block_set_corrupt(sc, bp);
275 xchk_block_set_corrupt(sc, bp);
278 xchk_block_set_preen(sc, bp);
288 xchk_block_set_corrupt(sc, bp);
294 xchk_block_set_preen(sc, bp);
301 xchk_block_set_corrupt(sc, bp);
306 xchk_block_set_corrupt(sc, bp);
311 xchk_block_set_corrupt(sc, bp);
320 xchk_block_set_preen(sc, bp);
325 xchk_block_set_corrupt(sc, bp);
333 xchk_block_set_preen(sc, bp);
338 xchk_block_set_corrupt(sc, bp);
341 xchk_block_set_preen(sc, bp);
349 xchk_block_set_corrupt(sc, bp);
355 xchk_block_set_corrupt(sc, bp);
357 xchk_superblock_xref(sc, bp);
381 struct xfs_scrub *sc)
383 struct xfs_agf *agf = sc->sa.agf_bp->b_addr;
387 if (!sc->sa.bno_cur)
390 error = xfs_alloc_query_all(sc->sa.bno_cur,
392 if (!xchk_should_check_xref(sc, &error, &sc->sa.bno_cur))
395 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp);
401 struct xfs_scrub *sc)
403 struct xfs_agf *agf = sc->sa.agf_bp->b_addr;
409 if (!sc->sa.cnt_cur)
413 error = xfs_alloc_lookup_le(sc->sa.cnt_cur, 0, -1U, &have);
414 if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur))
418 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp);
423 error = xfs_alloc_get_rec(sc->sa.cnt_cur, &agbno, &blocks, &have);
424 if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur))
427 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp);
433 struct xfs_scrub *sc)
435 struct xfs_agf *agf = sc->sa.agf_bp->b_addr;
436 struct xfs_mount *mp = sc->mp;
442 if (!xfs_has_lazysbcount(sc->mp))
446 if (sc->sa.rmap_cur) {
447 error = xfs_btree_count_blocks(sc->sa.rmap_cur, &blocks);
448 if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur))
452 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp);
461 if ((xfs_has_rmapbt(mp) && !sc->sa.rmap_cur) ||
462 !sc->sa.bno_cur || !sc->sa.cnt_cur)
466 error = xfs_btree_count_blocks(sc->sa.bno_cur, &blocks);
467 if (!xchk_should_check_xref(sc, &error, &sc->sa.bno_cur))
471 error = xfs_btree_count_blocks(sc->sa.cnt_cur, &blocks);
472 if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur))
477 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp);
483 struct xfs_scrub *sc)
485 struct xfs_agf *agf = sc->sa.agf_bp->b_addr;
489 if (!sc->sa.refc_cur)
492 error = xfs_btree_count_blocks(sc->sa.refc_cur, &blocks);
493 if (!xchk_should_check_xref(sc, &error, &sc->sa.refc_cur))
496 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp);
502 struct xfs_scrub *sc)
504 struct xfs_mount *mp = sc->mp;
507 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
512 xchk_ag_btcur_init(sc, &sc->sa);
514 xchk_xref_is_used_space(sc, agbno, 1);
515 xchk_agf_xref_freeblks(sc);
516 xchk_agf_xref_cntbt(sc);
517 xchk_xref_is_not_inode_chunk(sc, agbno, 1);
518 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS);
519 xchk_agf_xref_btreeblks(sc);
520 xchk_xref_is_not_shared(sc, agbno, 1);
521 xchk_xref_is_not_cow_staging(sc, agbno, 1);
522 xchk_agf_xref_refcblks(sc);
524 /* scrub teardown will take care of sc->sa for us */
530 struct xfs_scrub *sc)
532 struct xfs_mount *mp = sc->mp;
535 xfs_agnumber_t agno = sc->sm->sm_agno;
545 error = xchk_ag_read_headers(sc, agno, &sc->sa);
546 if (!xchk_process_error(sc, agno, XFS_AGF_BLOCK(sc->mp), &error))
548 xchk_buffer_recheck(sc, sc->sa.agf_bp);
550 agf = sc->sa.agf_bp->b_addr;
551 pag = sc->sa.pag;
556 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
561 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
565 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
569 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
573 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
578 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
582 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
588 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
592 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
604 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
608 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
610 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
611 if (xfs_has_lazysbcount(sc->mp) &&
613 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
615 xchk_agf_xref(sc);
633 struct xfs_scrub *sc;
639 struct xfs_scrub *sc,
642 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
645 xchk_xref_is_used_space(sc, agbno, 1);
646 xchk_xref_is_not_inode_chunk(sc, agbno, 1);
647 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_AG);
648 xchk_xref_is_not_shared(sc, agbno, 1);
649 xchk_xref_is_not_cow_staging(sc, agbno, 1);
660 struct xfs_scrub *sc = sai->sc;
662 if (xfs_verify_agbno(sc->sa.pag, agbno) &&
666 xchk_block_set_corrupt(sc, sai->agfl_bp);
668 xchk_agfl_block_xref(sc, agbno);
670 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
690 struct xfs_scrub *sc)
692 struct xfs_mount *mp = sc->mp;
695 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
700 xchk_ag_btcur_init(sc, &sc->sa);
702 xchk_xref_is_used_space(sc, agbno, 1);
703 xchk_xref_is_not_inode_chunk(sc, agbno, 1);
704 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS);
705 xchk_xref_is_not_shared(sc, agbno, 1);
706 xchk_xref_is_not_cow_staging(sc, agbno, 1);
709 * Scrub teardown will take care of sc->sa for us. Leave sc->sa
717 struct xfs_scrub *sc)
720 .sc = sc,
723 xfs_agnumber_t agno = sc->sm->sm_agno;
728 error = xchk_ag_read_headers(sc, agno, &sc->sa);
729 if (!xchk_process_error(sc, agno, XFS_AGFL_BLOCK(sc->mp), &error))
731 if (!sc->sa.agf_bp)
735 error = xfs_alloc_read_agfl(sc->sa.pag, sc->tp, &sai.agfl_bp);
736 if (!xchk_process_error(sc, agno, XFS_AGFL_BLOCK(sc->mp), &error))
738 xchk_buffer_recheck(sc, sai.agfl_bp);
740 xchk_agfl_xref(sc);
742 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
746 agf = sc->sa.agf_bp->b_addr;
748 if (sai.agflcount > xfs_agfl_size(sc->mp)) {
749 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
760 error = xfs_agfl_walk(sc->mp, sc->sa.agf_bp->b_addr, sai.agfl_bp,
770 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
779 xchk_block_set_corrupt(sc, sc->sa.agf_bp);
795 struct xfs_scrub *sc)
797 struct xfs_agi *agi = sc->sa.agi_bp->b_addr;
802 if (!sc->sa.ino_cur)
805 error = xfs_ialloc_count_inodes(sc->sa.ino_cur, &icount, &freecount);
806 if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur))
810 xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
816 struct xfs_scrub *sc)
818 struct xfs_agi *agi = sc->sa.agi_bp->b_addr;
822 if (!xfs_has_inobtcounts(sc->mp))
825 if (sc->sa.ino_cur) {
826 error = xfs_btree_count_blocks(sc->sa.ino_cur, &blocks);
827 if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur))
830 xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
833 if (sc->sa.fino_cur) {
834 error = xfs_btree_count_blocks(sc->sa.fino_cur, &blocks);
835 if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur))
838 xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp);
845 struct xfs_scrub *sc)
847 struct xfs_mount *mp = sc->mp;
850 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
855 xchk_ag_btcur_init(sc, &sc->sa);
857 xchk_xref_is_used_space(sc, agbno, 1);
858 xchk_xref_is_not_inode_chunk(sc, agbno, 1);
859 xchk_agi_xref_icounts(sc);
860 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS);
861 xchk_xref_is_not_shared(sc, agbno, 1);
862 xchk_xref_is_not_cow_staging(sc, agbno, 1);
863 xchk_agi_xref_fiblocks(sc);
865 /* scrub teardown will take care of sc->sa for us */
874 struct xfs_scrub *sc,
885 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
889 ip = xfs_iunlink_lookup(sc->sa.pag, agino);
891 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
896 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
908 struct xfs_scrub *sc)
910 struct xfs_mount *mp = sc->mp;
913 struct xfs_ino_geometry *igeo = M_IGEO(sc->mp);
914 xfs_agnumber_t agno = sc->sm->sm_agno;
925 error = xchk_ag_read_headers(sc, agno, &sc->sa);
926 if (!xchk_process_error(sc, agno, XFS_AGI_BLOCK(sc->mp), &error))
928 xchk_buffer_recheck(sc, sc->sa.agi_bp);
930 agi = sc->sa.agi_bp->b_addr;
931 pag = sc->sa.pag;
936 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
941 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
945 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
950 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
954 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
962 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
967 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
971 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
977 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
981 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
985 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
987 xchk_block_set_corrupt(sc, sc->sa.agi_bp);
989 xchk_iunlink(sc, agi);
991 xchk_agi_xref(sc);