Lines Matching refs:sc
65 struct xfs_scrub *sc, in __xchk_process_error() argument
78 sc->ip ? sc->ip : XFS_I(file_inode(sc->file)), in __xchk_process_error()
79 sc->sm, *error); in __xchk_process_error()
84 sc->sm->sm_flags |= errflag; in __xchk_process_error()
88 trace_xchk_op_error(sc, agno, bno, *error, in __xchk_process_error()
97 struct xfs_scrub *sc, in xchk_process_error() argument
102 return __xchk_process_error(sc, agno, bno, error, in xchk_process_error()
108 struct xfs_scrub *sc, in xchk_xref_process_error() argument
113 return __xchk_process_error(sc, agno, bno, error, in xchk_xref_process_error()
120 struct xfs_scrub *sc, in __xchk_fblock_process_error() argument
132 trace_xchk_deadlock_retry(sc->ip, sc->sm, *error); in __xchk_fblock_process_error()
137 sc->sm->sm_flags |= errflag; in __xchk_fblock_process_error()
141 trace_xchk_file_op_error(sc, whichfork, offset, *error, in __xchk_fblock_process_error()
150 struct xfs_scrub *sc, in xchk_fblock_process_error() argument
155 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_process_error()
161 struct xfs_scrub *sc, in xchk_fblock_xref_process_error() argument
166 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_xref_process_error()
185 struct xfs_scrub *sc, in xchk_block_set_preen() argument
188 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_block_set_preen()
189 trace_xchk_block_preen(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_preen()
199 struct xfs_scrub *sc, in xchk_ino_set_preen() argument
202 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_ino_set_preen()
203 trace_xchk_ino_preen(sc, ino, __return_address); in xchk_ino_set_preen()
209 struct xfs_scrub *sc) in xchk_set_corrupt() argument
211 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_set_corrupt()
212 trace_xchk_fs_error(sc, 0, __return_address); in xchk_set_corrupt()
218 struct xfs_scrub *sc, in xchk_block_set_corrupt() argument
221 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_block_set_corrupt()
222 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_corrupt()
228 struct xfs_scrub *sc, in xchk_block_xref_set_corrupt() argument
231 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_block_xref_set_corrupt()
232 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_xref_set_corrupt()
242 struct xfs_scrub *sc, in xchk_ino_set_corrupt() argument
245 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_ino_set_corrupt()
246 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_set_corrupt()
252 struct xfs_scrub *sc, in xchk_ino_xref_set_corrupt() argument
255 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_ino_xref_set_corrupt()
256 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_xref_set_corrupt()
262 struct xfs_scrub *sc, in xchk_fblock_set_corrupt() argument
266 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_fblock_set_corrupt()
267 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_set_corrupt()
273 struct xfs_scrub *sc, in xchk_fblock_xref_set_corrupt() argument
277 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_fblock_xref_set_corrupt()
278 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_xref_set_corrupt()
287 struct xfs_scrub *sc, in xchk_ino_set_warning() argument
290 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_ino_set_warning()
291 trace_xchk_ino_warning(sc, ino, __return_address); in xchk_ino_set_warning()
297 struct xfs_scrub *sc, in xchk_fblock_set_warning() argument
301 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_fblock_set_warning()
302 trace_xchk_fblock_warning(sc, whichfork, offset, __return_address); in xchk_fblock_set_warning()
308 struct xfs_scrub *sc) in xchk_set_incomplete() argument
310 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_INCOMPLETE; in xchk_set_incomplete()
311 trace_xchk_incomplete(sc, __return_address); in xchk_set_incomplete()
352 struct xfs_scrub *sc, in xchk_count_rmap_ownedby_ag() argument
378 struct xfs_scrub *sc, in want_ag_read_header_failure() argument
382 if (sc->sm->sm_type != XFS_SCRUB_TYPE_AGF && in want_ag_read_header_failure()
383 sc->sm->sm_type != XFS_SCRUB_TYPE_AGFL && in want_ag_read_header_failure()
384 sc->sm->sm_type != XFS_SCRUB_TYPE_AGI) in want_ag_read_header_failure()
391 if (sc->sm->sm_type == type) in want_ag_read_header_failure()
405 struct xfs_scrub *sc, in xchk_ag_read_headers() argument
409 struct xfs_mount *mp = sc->mp; in xchk_ag_read_headers()
417 error = xfs_ialloc_read_agi(mp, sc->tp, agno, &sa->agi_bp); in xchk_ag_read_headers()
418 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI)) in xchk_ag_read_headers()
421 error = xfs_alloc_read_agf(mp, sc->tp, agno, 0, &sa->agf_bp); in xchk_ag_read_headers()
422 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGF)) in xchk_ag_read_headers()
425 error = xfs_alloc_read_agfl(mp, sc->tp, agno, &sa->agfl_bp); in xchk_ag_read_headers()
426 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGFL)) in xchk_ag_read_headers()
461 struct xfs_scrub *sc, in xchk_ag_btcur_init() argument
464 struct xfs_mount *mp = sc->mp; in xchk_ag_btcur_init()
467 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_BNO)) { in xchk_ag_btcur_init()
469 sa->bno_cur = xfs_allocbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
474 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_CNT)) { in xchk_ag_btcur_init()
476 sa->cnt_cur = xfs_allocbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
482 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_INO)) { in xchk_ag_btcur_init()
483 sa->ino_cur = xfs_inobt_init_cursor(mp, sc->tp, sa->agi_bp, in xchk_ag_btcur_init()
489 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_FINO)) { in xchk_ag_btcur_init()
490 sa->fino_cur = xfs_inobt_init_cursor(mp, sc->tp, sa->agi_bp, in xchk_ag_btcur_init()
496 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_RMAP)) { in xchk_ag_btcur_init()
497 sa->rmap_cur = xfs_rmapbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
503 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_REFC)) { in xchk_ag_btcur_init()
504 sa->refc_cur = xfs_refcountbt_init_cursor(mp, sc->tp, in xchk_ag_btcur_init()
512 struct xfs_scrub *sc, in xchk_ag_free() argument
517 xfs_trans_brelse(sc->tp, sa->agfl_bp); in xchk_ag_free()
521 xfs_trans_brelse(sc->tp, sa->agf_bp); in xchk_ag_free()
525 xfs_trans_brelse(sc->tp, sa->agi_bp); in xchk_ag_free()
543 struct xfs_scrub *sc, in xchk_ag_init() argument
549 error = xchk_ag_read_headers(sc, agno, sa); in xchk_ag_init()
553 xchk_ag_btcur_init(sc, sa); in xchk_ag_init()
571 struct xfs_scrub *sc, in xchk_trans_alloc() argument
574 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) in xchk_trans_alloc()
575 return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, in xchk_trans_alloc()
576 resblks, 0, 0, &sc->tp); in xchk_trans_alloc()
578 return xfs_trans_alloc_empty(sc->mp, &sc->tp); in xchk_trans_alloc()
584 struct xfs_scrub *sc) in xchk_setup_fs() argument
588 resblks = xrep_calc_ag_resblks(sc); in xchk_setup_fs()
589 return xchk_trans_alloc(sc, resblks); in xchk_setup_fs()
595 struct xfs_scrub *sc, in xchk_setup_ag_btree() argument
598 struct xfs_mount *mp = sc->mp; in xchk_setup_ag_btree()
613 error = xchk_setup_fs(sc); in xchk_setup_ag_btree()
617 return xchk_ag_init(sc, sc->sm->sm_agno, &sc->sa); in xchk_setup_ag_btree()
641 struct xfs_scrub *sc) in xchk_get_inode() argument
644 struct xfs_mount *mp = sc->mp; in xchk_get_inode()
645 struct xfs_inode *ip_in = XFS_I(file_inode(sc->file)); in xchk_get_inode()
650 if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) { in xchk_get_inode()
651 sc->ip = ip_in; in xchk_get_inode()
656 if (xfs_internal_inum(mp, sc->sm->sm_ino)) in xchk_get_inode()
658 error = xfs_iget(mp, NULL, sc->sm->sm_ino, in xchk_get_inode()
680 error = xfs_imap(sc->mp, sc->tp, sc->sm->sm_ino, &imap, in xchk_get_inode()
687 trace_xchk_op_error(sc, in xchk_get_inode()
688 XFS_INO_TO_AGNO(mp, sc->sm->sm_ino), in xchk_get_inode()
689 XFS_INO_TO_AGBNO(mp, sc->sm->sm_ino), in xchk_get_inode()
693 if (VFS_I(ip)->i_generation != sc->sm->sm_gen) { in xchk_get_inode()
698 sc->ip = ip; in xchk_get_inode()
705 struct xfs_scrub *sc, in xchk_setup_inode_contents() argument
710 error = xchk_get_inode(sc); in xchk_setup_inode_contents()
715 sc->ilock_flags = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL; in xchk_setup_inode_contents()
716 xfs_ilock(sc->ip, sc->ilock_flags); in xchk_setup_inode_contents()
717 error = xchk_trans_alloc(sc, resblks); in xchk_setup_inode_contents()
720 sc->ilock_flags |= XFS_ILOCK_EXCL; in xchk_setup_inode_contents()
721 xfs_ilock(sc->ip, XFS_ILOCK_EXCL); in xchk_setup_inode_contents()
735 struct xfs_scrub *sc, in xchk_should_check_xref() argument
740 if (xchk_skip_xref(sc->sm)) in xchk_should_check_xref()
756 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL; in xchk_should_check_xref()
757 trace_xchk_xref_error(sc, *error, __return_address); in xchk_should_check_xref()
770 struct xfs_scrub *sc, in xchk_buffer_recheck() argument
776 xchk_block_set_corrupt(sc, bp); in xchk_buffer_recheck()
780 xchk_set_incomplete(sc); in xchk_buffer_recheck()
786 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_buffer_recheck()
787 trace_xchk_block_error(sc, xfs_buf_daddr(bp), fa); in xchk_buffer_recheck()
796 struct xfs_scrub *sc) in xchk_metadata_inode_forks() argument
802 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_metadata_inode_forks()
806 if (sc->ip->i_diflags & XFS_DIFLAG_REALTIME) { in xchk_metadata_inode_forks()
807 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
812 if (xfs_is_reflink_inode(sc->ip)) { in xchk_metadata_inode_forks()
813 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
818 if (xfs_inode_hasattr(sc->ip)) { in xchk_metadata_inode_forks()
819 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
824 smtype = sc->sm->sm_type; in xchk_metadata_inode_forks()
825 sc->sm->sm_type = XFS_SCRUB_TYPE_BMBTD; in xchk_metadata_inode_forks()
826 error = xchk_bmap_data(sc); in xchk_metadata_inode_forks()
827 sc->sm->sm_type = smtype; in xchk_metadata_inode_forks()
828 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
832 if (xfs_has_reflink(sc->mp)) { in xchk_metadata_inode_forks()
833 error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip, in xchk_metadata_inode_forks()
835 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, in xchk_metadata_inode_forks()
839 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
870 struct xfs_scrub *sc) in xchk_stop_reaping() argument
872 sc->flags |= XCHK_REAPING_DISABLED; in xchk_stop_reaping()
873 xfs_blockgc_stop(sc->mp); in xchk_stop_reaping()
874 xfs_inodegc_stop(sc->mp); in xchk_stop_reaping()
880 struct xfs_scrub *sc) in xchk_start_reaping() argument
886 if (!xfs_is_readonly(sc->mp)) { in xchk_start_reaping()
887 xfs_inodegc_start(sc->mp); in xchk_start_reaping()
888 xfs_blockgc_start(sc->mp); in xchk_start_reaping()
890 sc->flags &= ~XCHK_REAPING_DISABLED; in xchk_start_reaping()