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()
100 struct xfs_scrub *sc) in xchk_superblock() argument
102 struct xfs_mount *mp = sc->mp; in xchk_superblock()
113 agno = sc->sm->sm_agno; in xchk_superblock()
126 error = xfs_sb_read_secondary(mp, sc->tp, agno, &bp); in xchk_superblock()
144 if (!xchk_process_error(sc, agno, XFS_SB_BLOCK(mp), &error)) in xchk_superblock()
156 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
159 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
162 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
165 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
168 xchk_block_set_preen(sc, bp); in xchk_superblock()
171 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
174 xchk_block_set_preen(sc, bp); in xchk_superblock()
176 if (xfs_has_metadir(sc->mp)) { in xchk_superblock()
178 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
181 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
184 xchk_block_set_preen(sc, bp); in xchk_superblock()
187 xchk_block_set_preen(sc, bp); in xchk_superblock()
191 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
194 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
197 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
200 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
203 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
216 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
224 xchk_block_set_preen(sc, bp); in xchk_superblock()
227 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
230 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
233 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
236 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_corrupt(sc, bp); in xchk_superblock()
251 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
254 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
257 xchk_block_set_preen(sc, bp); in xchk_superblock()
266 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
269 xchk_block_set_preen(sc, bp); in xchk_superblock()
272 xchk_block_set_preen(sc, bp); in xchk_superblock()
275 xchk_block_set_preen(sc, bp); in xchk_superblock()
284 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
287 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
290 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
293 xchk_block_set_preen(sc, bp); in xchk_superblock()
296 xchk_block_set_preen(sc, bp); in xchk_superblock()
299 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
302 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
305 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
308 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
313 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
320 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
323 xchk_block_set_preen(sc, bp); in xchk_superblock()
333 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
339 xchk_block_set_preen(sc, bp); in xchk_superblock()
346 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
351 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
356 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
365 xchk_block_set_preen(sc, bp); in xchk_superblock()
370 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
378 xchk_block_set_preen(sc, bp); in xchk_superblock()
383 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
387 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
390 xchk_block_set_preen(sc, bp); in xchk_superblock()
399 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
404 xchk_block_set_preen(sc, bp); in xchk_superblock()
407 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
410 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
413 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
416 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
422 xchk_block_set_corrupt(sc, bp); in xchk_superblock()
424 xchk_superblock_xref(sc, bp); in xchk_superblock()
448 struct xfs_scrub *sc) in xchk_agf_xref_freeblks() argument
450 struct xfs_agf *agf = sc->sa.agf_bp->b_addr; in xchk_agf_xref_freeblks()
454 if (!sc->sa.bno_cur) in xchk_agf_xref_freeblks()
457 error = xfs_alloc_query_all(sc->sa.bno_cur, in xchk_agf_xref_freeblks()
459 if (!xchk_should_check_xref(sc, &error, &sc->sa.bno_cur)) in xchk_agf_xref_freeblks()
462 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_freeblks()
468 struct xfs_scrub *sc) in xchk_agf_xref_cntbt() argument
470 struct xfs_agf *agf = sc->sa.agf_bp->b_addr; in xchk_agf_xref_cntbt()
476 if (!sc->sa.cnt_cur) in xchk_agf_xref_cntbt()
480 error = xfs_alloc_lookup_le(sc->sa.cnt_cur, 0, -1U, &have); in xchk_agf_xref_cntbt()
481 if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur)) in xchk_agf_xref_cntbt()
485 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_cntbt()
490 error = xfs_alloc_get_rec(sc->sa.cnt_cur, &agbno, &blocks, &have); in xchk_agf_xref_cntbt()
491 if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur)) in xchk_agf_xref_cntbt()
494 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_cntbt()
500 struct xfs_scrub *sc) in xchk_agf_xref_btreeblks() argument
502 struct xfs_agf *agf = sc->sa.agf_bp->b_addr; in xchk_agf_xref_btreeblks()
503 struct xfs_mount *mp = sc->mp; in xchk_agf_xref_btreeblks()
509 if (!xfs_has_lazysbcount(sc->mp)) in xchk_agf_xref_btreeblks()
513 if (sc->sa.rmap_cur) { in xchk_agf_xref_btreeblks()
514 error = xfs_btree_count_blocks(sc->sa.rmap_cur, &blocks); in xchk_agf_xref_btreeblks()
515 if (!xchk_should_check_xref(sc, &error, &sc->sa.rmap_cur)) in xchk_agf_xref_btreeblks()
519 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_btreeblks()
528 if ((xfs_has_rmapbt(mp) && !sc->sa.rmap_cur) || in xchk_agf_xref_btreeblks()
529 !sc->sa.bno_cur || !sc->sa.cnt_cur) in xchk_agf_xref_btreeblks()
533 error = xfs_btree_count_blocks(sc->sa.bno_cur, &blocks); in xchk_agf_xref_btreeblks()
534 if (!xchk_should_check_xref(sc, &error, &sc->sa.bno_cur)) in xchk_agf_xref_btreeblks()
538 error = xfs_btree_count_blocks(sc->sa.cnt_cur, &blocks); in xchk_agf_xref_btreeblks()
539 if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur)) in xchk_agf_xref_btreeblks()
544 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_btreeblks()
550 struct xfs_scrub *sc) in xchk_agf_xref_refcblks() argument
552 struct xfs_agf *agf = sc->sa.agf_bp->b_addr; in xchk_agf_xref_refcblks()
556 if (!sc->sa.refc_cur) in xchk_agf_xref_refcblks()
559 error = xfs_btree_count_blocks(sc->sa.refc_cur, &blocks); in xchk_agf_xref_refcblks()
560 if (!xchk_should_check_xref(sc, &error, &sc->sa.refc_cur)) in xchk_agf_xref_refcblks()
563 xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf_xref_refcblks()
569 struct xfs_scrub *sc) in xchk_agf_xref() argument
571 struct xfs_mount *mp = sc->mp; in xchk_agf_xref()
574 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agf_xref()
579 xchk_ag_btcur_init(sc, &sc->sa); in xchk_agf_xref()
581 xchk_xref_is_used_space(sc, agbno, 1); in xchk_agf_xref()
582 xchk_agf_xref_freeblks(sc); in xchk_agf_xref()
583 xchk_agf_xref_cntbt(sc); in xchk_agf_xref()
584 xchk_xref_is_not_inode_chunk(sc, agbno, 1); in xchk_agf_xref()
585 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS); in xchk_agf_xref()
586 xchk_agf_xref_btreeblks(sc); in xchk_agf_xref()
587 xchk_xref_is_not_shared(sc, agbno, 1); in xchk_agf_xref()
588 xchk_xref_is_not_cow_staging(sc, agbno, 1); in xchk_agf_xref()
589 xchk_agf_xref_refcblks(sc); in xchk_agf_xref()
591 /* scrub teardown will take care of sc->sa for us */ in xchk_agf_xref()
597 struct xfs_scrub *sc) in xchk_agf() argument
599 struct xfs_mount *mp = sc->mp; in xchk_agf()
602 xfs_agnumber_t agno = sc->sm->sm_agno; in xchk_agf()
612 error = xchk_ag_read_headers(sc, agno, &sc->sa); in xchk_agf()
613 if (!xchk_process_error(sc, agno, XFS_AGF_BLOCK(sc->mp), &error)) in xchk_agf()
615 xchk_buffer_recheck(sc, sc->sa.agf_bp); in xchk_agf()
617 agf = sc->sa.agf_bp->b_addr; in xchk_agf()
618 pag = sc->sa.pag; in xchk_agf()
623 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
628 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
632 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
636 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
640 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
645 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
649 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
655 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
659 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
671 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()
677 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
678 if (xfs_has_lazysbcount(sc->mp) && in xchk_agf()
680 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agf()
682 xchk_agf_xref(sc); in xchk_agf()
700 struct xfs_scrub *sc; member
706 struct xfs_scrub *sc, in xchk_agfl_block_xref() argument
709 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agfl_block_xref()
712 xchk_xref_is_used_space(sc, agbno, 1); in xchk_agfl_block_xref()
713 xchk_xref_is_not_inode_chunk(sc, agbno, 1); in xchk_agfl_block_xref()
714 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_AG); in xchk_agfl_block_xref()
715 xchk_xref_is_not_shared(sc, agbno, 1); in xchk_agfl_block_xref()
716 xchk_xref_is_not_cow_staging(sc, agbno, 1); in xchk_agfl_block_xref()
727 struct xfs_scrub *sc = sai->sc; in xchk_agfl_block() local
729 if (xfs_verify_agbno(sc->sa.pag, agbno) && in xchk_agfl_block()
733 xchk_block_set_corrupt(sc, sai->agfl_bp); in xchk_agfl_block()
735 xchk_agfl_block_xref(sc, agbno); in xchk_agfl_block()
737 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agfl_block()
757 struct xfs_scrub *sc) in xchk_agfl_xref() argument
759 struct xfs_mount *mp = sc->mp; in xchk_agfl_xref()
762 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agfl_xref()
767 xchk_ag_btcur_init(sc, &sc->sa); in xchk_agfl_xref()
769 xchk_xref_is_used_space(sc, agbno, 1); in xchk_agfl_xref()
770 xchk_xref_is_not_inode_chunk(sc, agbno, 1); in xchk_agfl_xref()
771 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS); in xchk_agfl_xref()
772 xchk_xref_is_not_shared(sc, agbno, 1); in xchk_agfl_xref()
773 xchk_xref_is_not_cow_staging(sc, agbno, 1); in xchk_agfl_xref()
776 * Scrub teardown will take care of sc->sa for us. Leave sc->sa in xchk_agfl_xref()
784 struct xfs_scrub *sc) in xchk_agfl() argument
787 .sc = sc, in xchk_agfl()
790 xfs_agnumber_t agno = sc->sm->sm_agno; in xchk_agfl()
795 error = xchk_ag_read_headers(sc, agno, &sc->sa); in xchk_agfl()
796 if (!xchk_process_error(sc, agno, XFS_AGFL_BLOCK(sc->mp), &error)) in xchk_agfl()
798 if (!sc->sa.agf_bp) in xchk_agfl()
802 error = xfs_alloc_read_agfl(sc->sa.pag, sc->tp, &sai.agfl_bp); in xchk_agfl()
803 if (!xchk_process_error(sc, agno, XFS_AGFL_BLOCK(sc->mp), &error)) in xchk_agfl()
805 xchk_buffer_recheck(sc, sai.agfl_bp); in xchk_agfl()
807 xchk_agfl_xref(sc); in xchk_agfl()
809 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agfl()
813 agf = sc->sa.agf_bp->b_addr; in xchk_agfl()
815 if (sai.agflcount > xfs_agfl_size(sc->mp)) { in xchk_agfl()
816 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agfl()
827 error = xfs_agfl_walk(sc->mp, sc->sa.agf_bp->b_addr, sai.agfl_bp, in xchk_agfl()
837 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agfl()
846 xchk_block_set_corrupt(sc, sc->sa.agf_bp); in xchk_agfl()
862 struct xfs_scrub *sc) in xchk_agi_xref_icounts() argument
864 struct xfs_agi *agi = sc->sa.agi_bp->b_addr; in xchk_agi_xref_icounts()
869 if (!sc->sa.ino_cur) in xchk_agi_xref_icounts()
872 error = xfs_ialloc_count_inodes(sc->sa.ino_cur, &icount, &freecount); in xchk_agi_xref_icounts()
873 if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur)) in xchk_agi_xref_icounts()
877 xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi_xref_icounts()
883 struct xfs_scrub *sc) in xchk_agi_xref_fiblocks() argument
885 struct xfs_agi *agi = sc->sa.agi_bp->b_addr; in xchk_agi_xref_fiblocks()
889 if (!xfs_has_inobtcounts(sc->mp)) in xchk_agi_xref_fiblocks()
892 if (sc->sa.ino_cur) { in xchk_agi_xref_fiblocks()
893 error = xfs_btree_count_blocks(sc->sa.ino_cur, &blocks); in xchk_agi_xref_fiblocks()
894 if (!xchk_should_check_xref(sc, &error, &sc->sa.ino_cur)) in xchk_agi_xref_fiblocks()
897 xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi_xref_fiblocks()
900 if (sc->sa.fino_cur) { in xchk_agi_xref_fiblocks()
901 error = xfs_btree_count_blocks(sc->sa.fino_cur, &blocks); in xchk_agi_xref_fiblocks()
902 if (!xchk_should_check_xref(sc, &error, &sc->sa.fino_cur)) in xchk_agi_xref_fiblocks()
905 xchk_block_xref_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi_xref_fiblocks()
912 struct xfs_scrub *sc) in xchk_agi_xref() argument
914 struct xfs_mount *mp = sc->mp; in xchk_agi_xref()
917 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_agi_xref()
922 xchk_ag_btcur_init(sc, &sc->sa); in xchk_agi_xref()
924 xchk_xref_is_used_space(sc, agbno, 1); in xchk_agi_xref()
925 xchk_xref_is_not_inode_chunk(sc, agbno, 1); in xchk_agi_xref()
926 xchk_agi_xref_icounts(sc); in xchk_agi_xref()
927 xchk_xref_is_only_owned_by(sc, agbno, 1, &XFS_RMAP_OINFO_FS); in xchk_agi_xref()
928 xchk_xref_is_not_shared(sc, agbno, 1); in xchk_agi_xref()
929 xchk_xref_is_not_cow_staging(sc, agbno, 1); in xchk_agi_xref()
930 xchk_agi_xref_fiblocks(sc); in xchk_agi_xref()
932 /* scrub teardown will take care of sc->sa for us */ in xchk_agi_xref()
941 struct xfs_scrub *sc, in xchk_iunlink() argument
952 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_iunlink()
956 ip = xfs_iunlink_lookup(sc->sa.pag, agino); in xchk_iunlink()
958 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_iunlink()
963 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_iunlink()
975 struct xfs_scrub *sc) in xchk_agi() argument
977 struct xfs_mount *mp = sc->mp; in xchk_agi()
980 struct xfs_ino_geometry *igeo = M_IGEO(sc->mp); in xchk_agi()
981 xfs_agnumber_t agno = sc->sm->sm_agno; in xchk_agi()
992 error = xchk_ag_read_headers(sc, agno, &sc->sa); in xchk_agi()
993 if (!xchk_process_error(sc, agno, XFS_AGI_BLOCK(sc->mp), &error)) in xchk_agi()
995 xchk_buffer_recheck(sc, sc->sa.agi_bp); in xchk_agi()
997 agi = sc->sa.agi_bp->b_addr; in xchk_agi()
998 pag = sc->sa.pag; in xchk_agi()
1003 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1008 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1012 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1017 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1021 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1029 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1034 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1038 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1044 xchk_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1048 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_block_set_corrupt(sc, sc->sa.agi_bp); in xchk_agi()
1056 xchk_iunlink(sc, agi); in xchk_agi()
1058 xchk_agi_xref(sc); in xchk_agi()