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