Lines Matching full:sc
35 struct xfs_scrub *sc) in xchk_setup_inode_bmap() argument
39 if (xchk_need_intent_drain(sc)) in xchk_setup_inode_bmap()
40 xchk_fsgates_enable(sc, XCHK_FSGATES_DRAIN); in xchk_setup_inode_bmap()
42 error = xchk_iget_for_scrubbing(sc); in xchk_setup_inode_bmap()
46 xchk_ilock(sc, XFS_IOLOCK_EXCL); in xchk_setup_inode_bmap()
53 if (S_ISREG(VFS_I(sc->ip)->i_mode) && in xchk_setup_inode_bmap()
54 sc->sm->sm_type != XFS_SCRUB_TYPE_BMBTA) { in xchk_setup_inode_bmap()
55 struct address_space *mapping = VFS_I(sc->ip)->i_mapping; in xchk_setup_inode_bmap()
56 bool is_repair = xchk_could_repair(sc); in xchk_setup_inode_bmap()
58 xchk_ilock(sc, XFS_MMAPLOCK_EXCL); in xchk_setup_inode_bmap()
62 error = xfs_break_layouts(VFS_I(sc->ip), in xchk_setup_inode_bmap()
63 &sc->ilock_flags, BREAK_WRITE); in xchk_setup_inode_bmap()
68 inode_dio_wait(VFS_I(sc->ip)); in xchk_setup_inode_bmap()
92 VFS_I(sc->ip)->i_mapping); in xchk_setup_inode_bmap()
100 error = xchk_trans_alloc(sc, 0); in xchk_setup_inode_bmap()
104 error = xchk_ino_dqattach(sc); in xchk_setup_inode_bmap()
108 xchk_ilock(sc, XFS_ILOCK_EXCL); in xchk_setup_inode_bmap()
122 struct xfs_scrub *sc; member
152 struct xfs_btree_cur **curp = &info->sc->sa.rmap_cur; in xchk_bmap_get_rmap()
158 if (xfs_ifork_is_realtime(info->sc->ip, info->whichfork)) in xchk_bmap_get_rmap()
159 curp = &info->sc->sr.rmap_cur; in xchk_bmap_get_rmap()
190 if (!xchk_should_check_xref(info->sc, &error, curp)) in xchk_bmap_get_rmap()
194 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_get_rmap()
208 uint64_t owner = info->sc->ip->i_ino; in xchk_bmap_xref_rmap()
210 if (xchk_skip_xref(info->sc->sm)) in xchk_bmap_xref_rmap()
222 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
227 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
232 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
237 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
242 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
254 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
259 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
262 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
277 if (!info->sc->sa.rmap_cur || xchk_skip_xref(info->sc->sm)) in xchk_bmap_xref_rmap_cow()
290 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap_cow()
295 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap_cow()
300 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap_cow()
310 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap_cow()
313 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap_cow()
316 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap_cow()
331 error = xchk_rtgroup_init_existing(info->sc, in xchk_bmap_rt_iextent_xref()
333 &info->sc->sr); in xchk_bmap_rt_iextent_xref()
334 if (!xchk_fblock_process_error(info->sc, info->whichfork, in xchk_bmap_rt_iextent_xref()
338 error = xchk_rtgroup_lock(info->sc, &info->sc->sr, XCHK_RTGLOCK_ALL); in xchk_bmap_rt_iextent_xref()
339 if (!xchk_fblock_process_error(info->sc, info->whichfork, in xchk_bmap_rt_iextent_xref()
343 xchk_xref_is_used_rt_space(info->sc, irec->br_startblock, in xchk_bmap_rt_iextent_xref()
346 if (!xfs_has_rtrmapbt(info->sc->mp)) in xchk_bmap_rt_iextent_xref()
349 rgbno = xfs_rtb_to_rgbno(info->sc->mp, irec->br_startblock); in xchk_bmap_rt_iextent_xref()
354 if (!xfs_is_reflink_inode(info->sc->ip)) { in xchk_bmap_rt_iextent_xref()
355 xfs_rmap_ino_owner(&oinfo, info->sc->ip->i_ino, in xchk_bmap_rt_iextent_xref()
357 xchk_xref_is_only_rt_owned_by(info->sc, rgbno, in xchk_bmap_rt_iextent_xref()
359 xchk_xref_is_not_rt_shared(info->sc, rgbno, in xchk_bmap_rt_iextent_xref()
362 xchk_xref_is_not_rt_cow_staging(info->sc, rgbno, in xchk_bmap_rt_iextent_xref()
367 xchk_xref_is_only_rt_owned_by(info->sc, rgbno, in xchk_bmap_rt_iextent_xref()
369 xchk_xref_is_rt_cow_staging(info->sc, rgbno, in xchk_bmap_rt_iextent_xref()
371 xchk_xref_is_not_rt_shared(info->sc, rgbno, in xchk_bmap_rt_iextent_xref()
376 xchk_rtgroup_btcur_free(&info->sc->sr); in xchk_bmap_rt_iextent_xref()
378 xchk_rtgroup_free(info->sc, &info->sc->sr); in xchk_bmap_rt_iextent_xref()
389 struct xfs_mount *mp = info->sc->mp; in xchk_bmap_iextent_xref()
399 error = xchk_ag_init_existing(info->sc, agno, &info->sc->sa); in xchk_bmap_iextent_xref()
400 if (!xchk_fblock_process_error(info->sc, info->whichfork, in xchk_bmap_iextent_xref()
404 xchk_xref_is_used_space(info->sc, agbno, len); in xchk_bmap_iextent_xref()
405 xchk_xref_is_not_inode_chunk(info->sc, agbno, len); in xchk_bmap_iextent_xref()
409 if (!xfs_is_reflink_inode(info->sc->ip)) { in xchk_bmap_iextent_xref()
410 xfs_rmap_ino_owner(&oinfo, info->sc->ip->i_ino, in xchk_bmap_iextent_xref()
412 xchk_xref_is_only_owned_by(info->sc, agbno, in xchk_bmap_iextent_xref()
414 xchk_xref_is_not_shared(info->sc, agbno, in xchk_bmap_iextent_xref()
417 xchk_xref_is_not_cow_staging(info->sc, agbno, in xchk_bmap_iextent_xref()
422 xfs_rmap_ino_owner(&oinfo, info->sc->ip->i_ino, in xchk_bmap_iextent_xref()
424 xchk_xref_is_only_owned_by(info->sc, agbno, irec->br_blockcount, in xchk_bmap_iextent_xref()
426 xchk_xref_is_not_shared(info->sc, agbno, in xchk_bmap_iextent_xref()
428 xchk_xref_is_not_cow_staging(info->sc, agbno, in xchk_bmap_iextent_xref()
433 xchk_xref_is_only_owned_by(info->sc, agbno, irec->br_blockcount, in xchk_bmap_iextent_xref()
435 xchk_xref_is_cow_staging(info->sc, agbno, in xchk_bmap_iextent_xref()
437 xchk_xref_is_not_shared(info->sc, agbno, in xchk_bmap_iextent_xref()
443 xchk_ag_free(info->sc, &info->sc->sa); in xchk_bmap_iextent_xref()
463 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_dirattr_extent()
468 xchk_fblock_set_corrupt(info->sc, info->whichfork, off); in xchk_bmap_dirattr_extent()
478 struct xfs_mount *mp = info->sc->mp; in xchk_bmap_iextent()
486 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
490 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
498 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
502 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
508 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
511 if (info->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap_iextent()
547 xchk_fblock_set_corrupt(bs->sc, in xchk_bmapbt_rec()
564 xchk_fblock_set_corrupt(bs->sc, info->whichfork, in xchk_bmapbt_rec()
575 xchk_fblock_set_corrupt(bs->sc, info->whichfork, in xchk_bmapbt_rec()
583 struct xfs_scrub *sc, in xchk_bmap_btree() argument
588 struct xfs_ifork *ifp = xfs_ifork_ptr(sc->ip, whichfork); in xchk_bmap_btree()
589 struct xfs_mount *mp = sc->mp; in xchk_bmap_btree()
590 struct xfs_inode *ip = sc->ip; in xchk_bmap_btree()
597 error = xfs_iread_extents(sc->tp, ip, whichfork); in xchk_bmap_btree()
598 if (!xchk_fblock_process_error(sc, whichfork, 0, &error)) in xchk_bmap_btree()
602 cur = xfs_bmbt_init_cursor(mp, sc->tp, ip, whichfork); in xchk_bmap_btree()
604 error = xchk_btree(sc, cur, xchk_bmapbt_rec, &oinfo, info); in xchk_bmap_btree()
611 struct xfs_scrub *sc; member
627 struct xfs_scrub *sc = sbcri->sc; in xchk_bmap_check_rmap() local
631 if (rec->rm_owner != sc->ip->i_ino) in xchk_bmap_check_rmap()
640 ifp = xfs_ifork_ptr(sc->ip, sbcri->whichfork); in xchk_bmap_check_rmap()
642 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
646 have_map = xfs_iext_lookup_extent(sc->ip, ifp, rec->rm_offset, in xchk_bmap_check_rmap()
649 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
661 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
665 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
668 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
670 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap_check_rmap()
679 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
684 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap_check_rmap()
692 struct xfs_scrub *sc, in xchk_bmap_check_ag_rmaps() argument
701 error = xfs_alloc_read_agf(pag, sc->tp, 0, &agf); in xchk_bmap_check_ag_rmaps()
705 cur = xfs_rmapbt_init_cursor(sc->mp, sc->tp, agf, pag); in xchk_bmap_check_ag_rmaps()
707 sbcri.sc = sc; in xchk_bmap_check_ag_rmaps()
714 xfs_trans_brelse(sc->tp, agf); in xchk_bmap_check_ag_rmaps()
721 struct xfs_scrub *sc, in xchk_bmap_check_rt_rmaps() argument
729 cur = xfs_rtrmapbt_init_cursor(sc->tp, rtg); in xchk_bmap_check_rt_rmaps()
731 sbcri.sc = sc; in xchk_bmap_check_rt_rmaps()
822 struct xfs_scrub *sc = info->sc; in xchk_bmap_want_check_rmaps() local
824 if (!xfs_has_rmapbt(sc->mp)) in xchk_bmap_want_check_rmaps()
828 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap_want_check_rmaps()
832 return xchk_bmap_check_empty_attrfork(sc->ip); in xchk_bmap_want_check_rmaps()
834 return xchk_bmap_check_empty_datafork(sc->ip); in xchk_bmap_want_check_rmaps()
840 struct xfs_scrub *sc, in xchk_bmap_check_rmaps() argument
846 if (xfs_ifork_is_realtime(sc->ip, whichfork)) { in xchk_bmap_check_rmaps()
849 while ((rtg = xfs_rtgroup_next(sc->mp, rtg))) { in xchk_bmap_check_rmaps()
850 error = xchk_bmap_check_rt_rmaps(sc, rtg); in xchk_bmap_check_rmaps()
852 (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) { in xchk_bmap_check_rmaps()
861 while ((pag = xfs_perag_next(sc->mp, pag))) { in xchk_bmap_check_rmaps()
862 error = xchk_bmap_check_ag_rmaps(sc, whichfork, pag); in xchk_bmap_check_rmaps()
864 (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) { in xchk_bmap_check_rmaps()
880 struct xfs_mount *mp = info->sc->mp; in xchk_bmap_iextent_delalloc()
888 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent_delalloc()
892 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent_delalloc()
897 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent_delalloc()
922 struct xfs_mount *mp = info->sc->mp; in xchk_are_bmaps_contiguous()
966 ifp = xfs_ifork_ptr(info->sc->ip, info->whichfork); in xchk_bmap_iext_iter()
974 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iext_iter()
989 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iext_iter()
1006 xchk_ino_set_preen(info->sc, info->sc->ip->i_ino); in xchk_bmap_iext_iter()
1019 struct xfs_scrub *sc, in xchk_bmap() argument
1024 struct xfs_mount *mp = sc->mp; in xchk_bmap()
1025 struct xfs_inode *ip = sc->ip; in xchk_bmap()
1037 info.sc = sc; in xchk_bmap()
1043 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_bmap()
1055 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_bmap()
1070 xchk_fblock_set_corrupt(sc, whichfork, 0); in xchk_bmap()
1076 xchk_fblock_set_corrupt(sc, whichfork, 0); in xchk_bmap()
1080 error = xchk_bmap_btree(sc, whichfork, &info); in xchk_bmap()
1085 xchk_fblock_set_corrupt(sc, whichfork, 0); in xchk_bmap()
1089 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap()
1094 if (!xchk_fblock_process_error(sc, whichfork, 0, &error)) in xchk_bmap()
1106 if (xchk_should_terminate(sc, &error) || in xchk_bmap()
1107 (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_bmap()
1111 xchk_fblock_set_corrupt(sc, whichfork, in xchk_bmap()
1124 error = xchk_bmap_check_rmaps(sc, whichfork); in xchk_bmap()
1125 if (!xchk_fblock_xref_process_error(sc, whichfork, 0, &error)) in xchk_bmap()
1135 struct xfs_scrub *sc) in xchk_bmap_data() argument
1139 if (xchk_file_looks_zapped(sc, XFS_SICK_INO_BMBTD_ZAPPED)) { in xchk_bmap_data()
1140 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_bmap_data()
1144 error = xchk_bmap(sc, XFS_DATA_FORK); in xchk_bmap_data()
1149 xchk_mark_healthy_if_clean(sc, XFS_SICK_INO_BMBTD_ZAPPED); in xchk_bmap_data()
1156 struct xfs_scrub *sc) in xchk_bmap_attr() argument
1162 * reset to zero and hence sc->ip->i_afp is NULL. We don't want the in xchk_bmap_attr()
1167 if (xchk_file_looks_zapped(sc, XFS_SICK_INO_BMBTA_ZAPPED)) { in xchk_bmap_attr()
1168 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_bmap_attr()
1172 error = xchk_bmap(sc, XFS_ATTR_FORK); in xchk_bmap_attr()
1177 xchk_mark_healthy_if_clean(sc, XFS_SICK_INO_BMBTA_ZAPPED); in xchk_bmap_attr()
1184 struct xfs_scrub *sc) in xchk_bmap_cow() argument
1186 return xchk_bmap(sc, XFS_COW_FORK); in xchk_bmap_cow()