Lines Matching refs:sc
29 struct xfs_scrub *sc, in xchk_setup_inode_bmap() argument
34 error = xchk_get_inode(sc, ip); in xchk_setup_inode_bmap()
38 sc->ilock_flags = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL; in xchk_setup_inode_bmap()
39 xfs_ilock(sc->ip, sc->ilock_flags); in xchk_setup_inode_bmap()
46 if (S_ISREG(VFS_I(sc->ip)->i_mode) && in xchk_setup_inode_bmap()
47 sc->sm->sm_type == XFS_SCRUB_TYPE_BMBTD) { in xchk_setup_inode_bmap()
48 inode_dio_wait(VFS_I(sc->ip)); in xchk_setup_inode_bmap()
49 error = filemap_write_and_wait(VFS_I(sc->ip)->i_mapping); in xchk_setup_inode_bmap()
55 error = xchk_trans_alloc(sc, 0); in xchk_setup_inode_bmap()
58 sc->ilock_flags |= XFS_ILOCK_EXCL; in xchk_setup_inode_bmap()
59 xfs_ilock(sc->ip, XFS_ILOCK_EXCL); in xchk_setup_inode_bmap()
74 struct xfs_scrub *sc; member
114 error = xfs_rmap_lookup_le_range(info->sc->sa.rmap_cur, agbno, in xchk_bmap_get_rmap()
116 if (!xchk_should_check_xref(info->sc, &error, in xchk_bmap_get_rmap()
117 &info->sc->sa.rmap_cur)) in xchk_bmap_get_rmap()
125 error = xfs_rmap_lookup_le(info->sc->sa.rmap_cur, agbno, 0, owner, in xchk_bmap_get_rmap()
127 if (!xchk_should_check_xref(info->sc, &error, in xchk_bmap_get_rmap()
128 &info->sc->sa.rmap_cur)) in xchk_bmap_get_rmap()
133 error = xfs_rmap_get_rec(info->sc->sa.rmap_cur, rmap, &has_rmap); in xchk_bmap_get_rmap()
134 if (!xchk_should_check_xref(info->sc, &error, in xchk_bmap_get_rmap()
135 &info->sc->sa.rmap_cur)) in xchk_bmap_get_rmap()
140 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_get_rmap()
156 if (!info->sc->sa.rmap_cur || xchk_skip_xref(info->sc->sm)) in xchk_bmap_xref_rmap()
162 owner = info->sc->ip->i_ino; in xchk_bmap_xref_rmap()
172 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
185 xchk_fblock_xref_set_corrupt(info->sc, in xchk_bmap_xref_rmap()
190 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
203 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
208 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
211 xchk_fblock_xref_set_corrupt(info->sc, info->whichfork, in xchk_bmap_xref_rmap()
222 xchk_xref_is_used_rt_space(info->sc, irec->br_startblock, in xchk_bmap_rt_iextent_xref()
233 struct xfs_mount *mp = info->sc->mp; in xchk_bmap_iextent_xref()
243 error = xchk_ag_init(info->sc, agno, &info->sc->sa); in xchk_bmap_iextent_xref()
244 if (!xchk_fblock_process_error(info->sc, info->whichfork, in xchk_bmap_iextent_xref()
248 xchk_xref_is_used_space(info->sc, agbno, len); in xchk_bmap_iextent_xref()
249 xchk_xref_is_not_inode_chunk(info->sc, agbno, len); in xchk_bmap_iextent_xref()
253 if (xfs_is_reflink_inode(info->sc->ip)) in xchk_bmap_iextent_xref()
257 xchk_xref_is_not_shared(info->sc, agbno, in xchk_bmap_iextent_xref()
261 xchk_xref_is_cow_staging(info->sc, agbno, in xchk_bmap_iextent_xref()
266 xchk_ag_free(info->sc, &info->sc->sa); in xchk_bmap_iextent_xref()
286 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_dirattr_extent()
291 xchk_fblock_set_corrupt(info->sc, info->whichfork, off); in xchk_bmap_dirattr_extent()
301 struct xfs_mount *mp = info->sc->mp; in xchk_bmap_iextent()
310 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
317 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
325 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
330 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
333 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
339 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
346 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
352 xchk_fblock_set_corrupt(info->sc, info->whichfork, in xchk_bmap_iextent()
355 if (info->sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap_iextent()
394 xchk_fblock_set_corrupt(bs->sc, in xchk_bmapbt_rec()
416 xchk_fblock_set_corrupt(bs->sc, info->whichfork, in xchk_bmapbt_rec()
424 struct xfs_scrub *sc, in xchk_bmap_btree() argument
429 struct xfs_ifork *ifp = XFS_IFORK_PTR(sc->ip, whichfork); in xchk_bmap_btree()
430 struct xfs_mount *mp = sc->mp; in xchk_bmap_btree()
431 struct xfs_inode *ip = sc->ip; in xchk_bmap_btree()
438 error = xfs_iread_extents(sc->tp, ip, whichfork); in xchk_bmap_btree()
439 if (!xchk_fblock_process_error(sc, whichfork, 0, &error)) in xchk_bmap_btree()
444 cur = xfs_bmbt_init_cursor(mp, sc->tp, ip, whichfork); in xchk_bmap_btree()
446 error = xchk_btree(sc, cur, xchk_bmapbt_rec, &oinfo, info); in xchk_bmap_btree()
453 struct xfs_scrub *sc; member
468 struct xfs_scrub *sc = sbcri->sc; in xchk_bmap_check_rmap() local
472 if (rec->rm_owner != sc->ip->i_ino) in xchk_bmap_check_rmap()
481 ifp = XFS_IFORK_PTR(sc->ip, sbcri->whichfork); in xchk_bmap_check_rmap()
483 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
487 have_map = xfs_iext_lookup_extent(sc->ip, ifp, rec->rm_offset, in xchk_bmap_check_rmap()
490 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
501 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
503 if (irec.br_startblock != XFS_AGB_TO_FSB(sc->mp, in xchk_bmap_check_rmap()
505 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
508 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
510 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap_check_rmap()
519 xchk_fblock_set_corrupt(sc, sbcri->whichfork, in xchk_bmap_check_rmap()
524 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap_check_rmap()
532 struct xfs_scrub *sc, in xchk_bmap_check_ag_rmaps() argument
541 error = xfs_alloc_read_agf(sc->mp, sc->tp, agno, 0, &agf); in xchk_bmap_check_ag_rmaps()
545 cur = xfs_rmapbt_init_cursor(sc->mp, sc->tp, agf, agno); in xchk_bmap_check_ag_rmaps()
551 sbcri.sc = sc; in xchk_bmap_check_ag_rmaps()
559 xfs_trans_brelse(sc->tp, agf); in xchk_bmap_check_ag_rmaps()
566 struct xfs_scrub *sc, in xchk_bmap_check_rmaps() argument
573 if (!xfs_sb_version_hasrmapbt(&sc->mp->m_sb) || in xchk_bmap_check_rmaps()
575 (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_bmap_check_rmaps()
579 if (XFS_IS_REALTIME_INODE(sc->ip) && whichfork == XFS_DATA_FORK) in xchk_bmap_check_rmaps()
591 size = i_size_read(VFS_I(sc->ip)); in xchk_bmap_check_rmaps()
594 size = XFS_IFORK_Q(sc->ip); in xchk_bmap_check_rmaps()
600 if (XFS_IFORK_FORMAT(sc->ip, whichfork) != XFS_DINODE_FMT_BTREE && in xchk_bmap_check_rmaps()
601 (size == 0 || XFS_IFORK_NEXTENTS(sc->ip, whichfork) > 0)) in xchk_bmap_check_rmaps()
604 for (agno = 0; agno < sc->mp->m_sb.sb_agcount; agno++) { in xchk_bmap_check_rmaps()
605 error = xchk_bmap_check_ag_rmaps(sc, whichfork, agno); in xchk_bmap_check_rmaps()
608 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap_check_rmaps()
623 struct xfs_scrub *sc, in xchk_bmap() argument
628 struct xfs_mount *mp = sc->mp; in xchk_bmap()
629 struct xfs_inode *ip = sc->ip; in xchk_bmap()
640 info.sc = sc; in xchk_bmap()
649 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_bmap()
658 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_bmap()
674 xchk_fblock_set_corrupt(sc, whichfork, 0); in xchk_bmap()
680 xchk_fblock_set_corrupt(sc, whichfork, 0); in xchk_bmap()
684 error = xchk_bmap_btree(sc, whichfork, &info); in xchk_bmap()
689 xchk_fblock_set_corrupt(sc, whichfork, 0); in xchk_bmap()
693 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_bmap()
698 if (!xchk_fblock_process_error(sc, whichfork, 0, &error)) in xchk_bmap()
705 if (xchk_should_terminate(sc, &error) || in xchk_bmap()
706 (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_bmap()
711 xchk_fblock_set_corrupt(sc, whichfork, in xchk_bmap()
721 error = xchk_bmap_check_rmaps(sc, whichfork); in xchk_bmap()
722 if (!xchk_fblock_xref_process_error(sc, whichfork, 0, &error)) in xchk_bmap()
731 struct xfs_scrub *sc) in xchk_bmap_data() argument
733 return xchk_bmap(sc, XFS_DATA_FORK); in xchk_bmap_data()
739 struct xfs_scrub *sc) in xchk_bmap_attr() argument
741 return xchk_bmap(sc, XFS_ATTR_FORK); in xchk_bmap_attr()
747 struct xfs_scrub *sc) in xchk_bmap_cow() argument
749 if (!xfs_is_reflink_inode(sc->ip)) in xchk_bmap_cow()
752 return xchk_bmap(sc, XFS_COW_FORK); in xchk_bmap_cow()