Lines Matching full:sc
24 struct xfs_scrub *sc) in xchk_setup_agheader() argument
26 if (xchk_need_intent_drain(sc)) in xchk_setup_agheader()
27 xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN); in xchk_setup_agheader()
28 return xchk_setup_fs(sc); in xchk_setup_agheader()
36 struct xfs_scrub *sc, in xchk_superblock_xref() argument
39 struct xfs_mount *mp = sc->mp; in xchk_superblock_xref()
40 xfs_agnumber_t agno = sc->sm->sm_agno; in xchk_superblock_xref()
44 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_superblock_xref()
49 error = xchk_ag_init_existing(sc, agno, &sc->sa); in xchk_superblock_xref()
50 if (!xchk_xref_process_error(sc, agno, agbno, &error)) in xchk_superblock_xref()
53 xchk_xref_is_used_space(sc, agbno, 1); in xchk_superblock_xref()
54 xchk_xref_is_not_inode_chunk(sc, agbno, 1); in xchk_superblock_xref()
55 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS); in xchk_superblock_xref()
56 xchk_xref_is_not_shared(sc, agbno, 1); in xchk_superblock_xref()
57 xchk_xref_is_not_cow_staging(sc, agbno, 1); in xchk_superblock_xref()
59 /* scrub teardown will take care of sc->sa for us */ in xchk_superblock_xref()
98 struct xfs_scrub *sc) in xchk_superblock() argument
100 struct xfs_mount *mp = sc->mp; in xchk_superblock()
111 agno = sc->sm->sm_agno; in xchk_superblock()
124 error = xfs_sb_read_secondary(mp, sc->tp, agno, &bp); in xchk_superblock()
142 if (!xchk_process_error(sc, agno, XFS_SB_BLOCK(mp), &error)) in xchk_superblock()
154 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
157 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
160 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
163 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
166 xchk_block_set_preen(sc, bp); in xchk_superblock()
169 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
172 xchk_block_set_preen(sc, bp); in xchk_superblock()
174 if (xfs_has_metadir(sc->mp)) { in xchk_superblock()
176 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
179 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
182 xchk_block_set_preen(sc, bp); in xchk_superblock()
185 xchk_block_set_preen(sc, bp); in xchk_superblock()
189 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
192 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
195 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
198 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
201 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
214 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
222 xchk_block_set_preen(sc, bp); in xchk_superblock()
225 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
228 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
231 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
234 xchk_block_set_preen(sc, bp); in xchk_superblock()
237 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
240 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
243 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
246 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
249 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
252 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
255 xchk_block_set_preen(sc, bp); in xchk_superblock()
264 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
267 xchk_block_set_preen(sc, bp); in xchk_superblock()
270 xchk_block_set_preen(sc, bp); in xchk_superblock()
273 xchk_block_set_preen(sc, bp); in xchk_superblock()
282 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
285 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
288 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
291 xchk_block_set_preen(sc, bp); in xchk_superblock()
294 xchk_block_set_preen(sc, bp); in xchk_superblock()
297 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
300 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
303 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
306 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
311 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
318 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
321 xchk_block_set_preen(sc, bp); in xchk_superblock()
331 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
337 xchk_block_set_preen(sc, bp); in xchk_superblock()
344 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
349 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
354 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
363 xchk_block_set_preen(sc, bp); in xchk_superblock()
368 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
376 xchk_block_set_preen(sc, bp); in xchk_superblock()
381 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
385 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
388 xchk_block_set_preen(sc, bp); in xchk_superblock()
397 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
402 xchk_block_set_preen(sc, bp); in xchk_superblock()
405 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
408 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
411 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
414 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
420 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
422 xchk_superblock_xref(sc, bp); in xchk_superblock()
446 struct xfs_scrub *sc) in xchk_agf_xref_freeblks() argument
448 struct xfs_agf *agf = sc->sa.agf_bp->b_addr; in xchk_agf_xref_freeblks()
452 if (!sc->sa.bno_cur) in xchk_agf_xref_freeblks()
455 error = xfs_alloc_query_all(sc->sa.bno_cur, in xchk_agf_xref_freeblks()
457 if (!xchk_should_check_xref(sc, &error, &sc->sa.bno_cur)) in xchk_agf_xref_freeblks()
460 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_freeblks()
466 struct xfs_scrub *sc) in xchk_agf_xref_cntbt() argument
468 struct xfs_agf *agf = sc->sa.agf_bp->b_addr; in xchk_agf_xref_cntbt()
474 if (!sc->sa.cnt_cur) in xchk_agf_xref_cntbt()
478 error = xfs_alloc_lookup_le(sc->sa.cnt_cur, 0, -1U, &have); in xchk_agf_xref_cntbt()
479 if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur)) in xchk_agf_xref_cntbt()
483 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_cntbt()
488 error = xfs_alloc_get_rec(sc->sa.cnt_cur, &agbno, &blocks, &have); in xchk_agf_xref_cntbt()
489 if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur)) in xchk_agf_xref_cntbt()
492 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_cntbt()
498 struct xfs_scrub *sc) in xchk_agf_xref_btreeblks() argument
500 struct xfs_agf *agf = sc->sa.agf_bp->b_addr; in xchk_agf_xref_btreeblks()
501 struct xfs_mount *mp = sc->mp; in xchk_agf_xref_btreeblks()
507 if (!xfs_has_lazysbcount(sc->mp)) in xchk_agf_xref_btreeblks()
511 if (sc->sa.rmap_cur) { in xchk_agf_xref_btreeblks()
512 error = xfs_btree_count_blocks(sc->sa.rmap_cur, &blocks); in xchk_agf_xref_btreeblks()
513 if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur)) in xchk_agf_xref_btreeblks()
517 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_btreeblks()
526 if ((xfs_has_rmapbt(mp) && !sc->sa.rmap_cur) || in xchk_agf_xref_btreeblks()
527 !sc->sa.bno_cur || !sc->sa.cnt_cur) in xchk_agf_xref_btreeblks()
531 error = xfs_btree_count_blocks(sc->sa.bno_cur, &blocks); in xchk_agf_xref_btreeblks()
532 if (!xchk_should_check_xref(sc, &error, &sc->sa.bno_cur)) in xchk_agf_xref_btreeblks()
536 error = xfs_btree_count_blocks(sc->sa.cnt_cur, &blocks); in xchk_agf_xref_btreeblks()
537 if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur)) in xchk_agf_xref_btreeblks()
542 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_btreeblks()
548 struct xfs_scrub *sc) in xchk_agf_xref_refcblks() argument
550 struct xfs_agf *agf = sc->sa.agf_bp->b_addr; in xchk_agf_xref_refcblks()
554 if (!sc->sa.refc_cur) in xchk_agf_xref_refcblks()
557 error = xfs_btree_count_blocks(sc->sa.refc_cur, &blocks); in xchk_agf_xref_refcblks()
558 if (!xchk_should_check_xref(sc, &error, &sc->sa.refc_cur)) in xchk_agf_xref_refcblks()
561 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_refcblks()
567 struct xfs_scrub *sc) in xchk_agf_xref() argument
569 struct xfs_mount *mp = sc->mp; in xchk_agf_xref()
572 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agf_xref()
577 xchk_ag_btcur_init(sc, &sc->sa); in xchk_agf_xref()
579 xchk_xref_is_used_space(sc, agbno, 1); in xchk_agf_xref()
580 xchk_agf_xref_freeblks(sc); in xchk_agf_xref()
581 xchk_agf_xref_cntbt(sc); in xchk_agf_xref()
582 xchk_xref_is_not_inode_chunk(sc, agbno, 1); in xchk_agf_xref()
583 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS); in xchk_agf_xref()
584 xchk_agf_xref_btreeblks(sc); in xchk_agf_xref()
585 xchk_xref_is_not_shared(sc, agbno, 1); in xchk_agf_xref()
586 xchk_xref_is_not_cow_staging(sc, agbno, 1); in xchk_agf_xref()
587 xchk_agf_xref_refcblks(sc); in xchk_agf_xref()
589 /* scrub teardown will take care of sc->sa for us */ in xchk_agf_xref()
595 struct xfs_scrub *sc) in xchk_agf() argument
597 struct xfs_mount *mp = sc->mp; in xchk_agf()
600 xfs_agnumber_t agno = sc->sm->sm_agno; in xchk_agf()
610 error = xchk_ag_read_headers(sc, agno, &sc->sa); in xchk_agf()
611 if (!xchk_process_error(sc, agno, XFS_AGF_BLOCK(sc->mp), &error)) in xchk_agf()
613 xchk_buffer_recheck(sc, sc->sa.agf_bp); in xchk_agf()
615 agf = sc->sa.agf_bp->b_addr; in xchk_agf()
616 pag = sc->sa.pag; in xchk_agf()
621 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
626 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
630 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
634 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
638 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
643 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
647 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
653 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
657 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
669 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
673 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
675 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
676 if (xfs_has_lazysbcount(sc->mp) && in xchk_agf()
678 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
680 xchk_agf_xref(sc); in xchk_agf()
698 struct xfs_scrub *sc; member
704 struct xfs_scrub *sc, in xchk_agfl_block_xref() argument
707 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agfl_block_xref()
710 xchk_xref_is_used_space(sc, agbno, 1); in xchk_agfl_block_xref()
711 xchk_xref_is_not_inode_chunk(sc, agbno, 1); in xchk_agfl_block_xref()
712 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_AG); in xchk_agfl_block_xref()
713 xchk_xref_is_not_shared(sc, agbno, 1); in xchk_agfl_block_xref()
714 xchk_xref_is_not_cow_staging(sc, agbno, 1); in xchk_agfl_block_xref()
725 struct xfs_scrub *sc = sai->sc; in xchk_agfl_block() local
727 if (xfs_verify_agbno(sc->sa.pag, agbno) && in xchk_agfl_block()
731 xchk_block_set_corrupt(sc, sai->agfl_bp); in xchk_agfl_block()
733 xchk_agfl_block_xref(sc, agbno); in xchk_agfl_block()
735 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agfl_block()
755 struct xfs_scrub *sc) in xchk_agfl_xref() argument
757 struct xfs_mount *mp = sc->mp; in xchk_agfl_xref()
760 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agfl_xref()
765 xchk_ag_btcur_init(sc, &sc->sa); in xchk_agfl_xref()
767 xchk_xref_is_used_space(sc, agbno, 1); in xchk_agfl_xref()
768 xchk_xref_is_not_inode_chunk(sc, agbno, 1); in xchk_agfl_xref()
769 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS); in xchk_agfl_xref()
770 xchk_xref_is_not_shared(sc, agbno, 1); in xchk_agfl_xref()
771 xchk_xref_is_not_cow_staging(sc, agbno, 1); in xchk_agfl_xref()
774 * Scrub teardown will take care of sc->sa for us. Leave sc->sa in xchk_agfl_xref()
782 struct xfs_scrub *sc) in xchk_agfl() argument
785 .sc = sc, in xchk_agfl()
788 xfs_agnumber_t agno = sc->sm->sm_agno; in xchk_agfl()
793 error = xchk_ag_read_headers(sc, agno, &sc->sa); in xchk_agfl()
794 if (!xchk_process_error(sc, agno, XFS_AGFL_BLOCK(sc->mp), &error)) in xchk_agfl()
796 if (!sc->sa.agf_bp) in xchk_agfl()
800 error = xfs_alloc_read_agfl(sc->sa.pag, sc->tp, &sai.agfl_bp); in xchk_agfl()
801 if (!xchk_process_error(sc, agno, XFS_AGFL_BLOCK(sc->mp), &error)) in xchk_agfl()
803 xchk_buffer_recheck(sc, sai.agfl_bp); in xchk_agfl()
805 xchk_agfl_xref(sc); in xchk_agfl()
807 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agfl()
811 agf = sc->sa.agf_bp->b_addr; in xchk_agfl()
813 if (sai.agflcount > xfs_agfl_size(sc->mp)) { in xchk_agfl()
814 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agfl()
825 error = xfs_agfl_walk(sc->mp, sc->sa.agf_bp->b_addr, sai.agfl_bp, in xchk_agfl()
835 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agfl()
844 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agfl()
860 struct xfs_scrub *sc) in xchk_agi_xref_icounts() argument
862 struct xfs_agi *agi = sc->sa.agi_bp->b_addr; in xchk_agi_xref_icounts()
867 if (!sc->sa.ino_cur) in xchk_agi_xref_icounts()
870 error = xfs_ialloc_count_inodes(sc->sa.ino_cur, &icount, &freecount); in xchk_agi_xref_icounts()
871 if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur)) in xchk_agi_xref_icounts()
875 xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi_xref_icounts()
881 struct xfs_scrub *sc) in xchk_agi_xref_fiblocks() argument
883 struct xfs_agi *agi = sc->sa.agi_bp->b_addr; in xchk_agi_xref_fiblocks()
887 if (!xfs_has_inobtcounts(sc->mp)) in xchk_agi_xref_fiblocks()
890 if (sc->sa.ino_cur) { in xchk_agi_xref_fiblocks()
891 error = xfs_btree_count_blocks(sc->sa.ino_cur, &blocks); in xchk_agi_xref_fiblocks()
892 if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur)) in xchk_agi_xref_fiblocks()
895 xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi_xref_fiblocks()
898 if (sc->sa.fino_cur) { in xchk_agi_xref_fiblocks()
899 error = xfs_btree_count_blocks(sc->sa.fino_cur, &blocks); in xchk_agi_xref_fiblocks()
900 if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur)) in xchk_agi_xref_fiblocks()
903 xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi_xref_fiblocks()
910 struct xfs_scrub *sc) in xchk_agi_xref() argument
912 struct xfs_mount *mp = sc->mp; in xchk_agi_xref()
915 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agi_xref()
920 xchk_ag_btcur_init(sc, &sc->sa); in xchk_agi_xref()
922 xchk_xref_is_used_space(sc, agbno, 1); in xchk_agi_xref()
923 xchk_xref_is_not_inode_chunk(sc, agbno, 1); in xchk_agi_xref()
924 xchk_agi_xref_icounts(sc); in xchk_agi_xref()
925 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS); in xchk_agi_xref()
926 xchk_xref_is_not_shared(sc, agbno, 1); in xchk_agi_xref()
927 xchk_xref_is_not_cow_staging(sc, agbno, 1); in xchk_agi_xref()
928 xchk_agi_xref_fiblocks(sc); in xchk_agi_xref()
930 /* scrub teardown will take care of sc->sa for us */ in xchk_agi_xref()
939 struct xfs_scrub *sc, in xchk_iunlink() argument
950 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_iunlink()
954 ip = xfs_iunlink_lookup(sc->sa.pag, agino); in xchk_iunlink()
956 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_iunlink()
961 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_iunlink()
973 struct xfs_scrub *sc) in xchk_agi() argument
975 struct xfs_mount *mp = sc->mp; in xchk_agi()
978 struct xfs_ino_geometry *igeo = M_IGEO(sc->mp); in xchk_agi()
979 xfs_agnumber_t agno = sc->sm->sm_agno; in xchk_agi()
990 error = xchk_ag_read_headers(sc, agno, &sc->sa); in xchk_agi()
991 if (!xchk_process_error(sc, agno, XFS_AGI_BLOCK(sc->mp), &error)) in xchk_agi()
993 xchk_buffer_recheck(sc, sc->sa.agi_bp); in xchk_agi()
995 agi = sc->sa.agi_bp->b_addr; in xchk_agi()
996 pag = sc->sa.pag; in xchk_agi()
1001 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1006 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1010 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1015 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1019 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1027 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1032 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1036 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1042 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1046 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1050 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1052 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1054 xchk_iunlink(sc, agi); in xchk_agi()
1056 xchk_agi_xref(sc); in xchk_agi()