Lines Matching refs:sc

67 	struct xfs_scrub	*sc,  in __xchk_process_error()  argument
80 sc->ip ? sc->ip : XFS_I(file_inode(sc->file)), in __xchk_process_error()
81 sc->sm, *error); in __xchk_process_error()
86 sc->sm->sm_flags |= errflag; in __xchk_process_error()
90 trace_xchk_op_error(sc, agno, bno, *error, in __xchk_process_error()
99 struct xfs_scrub *sc, in xchk_process_error() argument
104 return __xchk_process_error(sc, agno, bno, error, in xchk_process_error()
110 struct xfs_scrub *sc, in xchk_xref_process_error() argument
115 return __xchk_process_error(sc, agno, bno, error, in xchk_xref_process_error()
122 struct xfs_scrub *sc, in __xchk_fblock_process_error() argument
134 trace_xchk_deadlock_retry(sc->ip, sc->sm, *error); in __xchk_fblock_process_error()
139 sc->sm->sm_flags |= errflag; in __xchk_fblock_process_error()
143 trace_xchk_file_op_error(sc, whichfork, offset, *error, in __xchk_fblock_process_error()
152 struct xfs_scrub *sc, in xchk_fblock_process_error() argument
157 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_process_error()
163 struct xfs_scrub *sc, in xchk_fblock_xref_process_error() argument
168 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_xref_process_error()
187 struct xfs_scrub *sc, in xchk_block_set_preen() argument
190 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_block_set_preen()
191 trace_xchk_block_preen(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_preen()
201 struct xfs_scrub *sc, in xchk_ino_set_preen() argument
204 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_ino_set_preen()
205 trace_xchk_ino_preen(sc, ino, __return_address); in xchk_ino_set_preen()
211 struct xfs_scrub *sc) in xchk_set_corrupt() argument
213 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_set_corrupt()
214 trace_xchk_fs_error(sc, 0, __return_address); in xchk_set_corrupt()
220 struct xfs_scrub *sc, in xchk_block_set_corrupt() argument
223 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_block_set_corrupt()
224 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_corrupt()
230 struct xfs_scrub *sc, in xchk_block_xref_set_corrupt() argument
233 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_block_xref_set_corrupt()
234 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_xref_set_corrupt()
244 struct xfs_scrub *sc, in xchk_ino_set_corrupt() argument
247 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_ino_set_corrupt()
248 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_set_corrupt()
254 struct xfs_scrub *sc, in xchk_ino_xref_set_corrupt() argument
257 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_ino_xref_set_corrupt()
258 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_xref_set_corrupt()
264 struct xfs_scrub *sc, in xchk_fblock_set_corrupt() argument
268 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_fblock_set_corrupt()
269 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_set_corrupt()
275 struct xfs_scrub *sc, in xchk_fblock_xref_set_corrupt() argument
279 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_fblock_xref_set_corrupt()
280 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_xref_set_corrupt()
289 struct xfs_scrub *sc, in xchk_ino_set_warning() argument
292 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_ino_set_warning()
293 trace_xchk_ino_warning(sc, ino, __return_address); in xchk_ino_set_warning()
299 struct xfs_scrub *sc, in xchk_fblock_set_warning() argument
303 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_fblock_set_warning()
304 trace_xchk_fblock_warning(sc, whichfork, offset, __return_address); in xchk_fblock_set_warning()
310 struct xfs_scrub *sc) in xchk_set_incomplete() argument
312 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_INCOMPLETE; in xchk_set_incomplete()
313 trace_xchk_incomplete(sc, __return_address); in xchk_set_incomplete()
354 struct xfs_scrub *sc, in xchk_count_rmap_ownedby_ag() argument
380 struct xfs_scrub *sc, in want_ag_read_header_failure() argument
384 if (sc->sm->sm_type != XFS_SCRUB_TYPE_AGF && in want_ag_read_header_failure()
385 sc->sm->sm_type != XFS_SCRUB_TYPE_AGFL && in want_ag_read_header_failure()
386 sc->sm->sm_type != XFS_SCRUB_TYPE_AGI) in want_ag_read_header_failure()
393 if (sc->sm->sm_type == type) in want_ag_read_header_failure()
407 struct xfs_scrub *sc, in xchk_ag_read_headers() argument
411 struct xfs_mount *mp = sc->mp; in xchk_ag_read_headers()
419 error = xfs_ialloc_read_agi(sa->pag, sc->tp, &sa->agi_bp); in xchk_ag_read_headers()
420 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI)) in xchk_ag_read_headers()
423 error = xfs_alloc_read_agf(sa->pag, sc->tp, 0, &sa->agf_bp); in xchk_ag_read_headers()
424 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGF)) in xchk_ag_read_headers()
427 error = xfs_alloc_read_agfl(sa->pag, sc->tp, &sa->agfl_bp); in xchk_ag_read_headers()
428 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGFL)) in xchk_ag_read_headers()
463 struct xfs_scrub *sc, in xchk_ag_btcur_init() argument
466 struct xfs_mount *mp = sc->mp; in xchk_ag_btcur_init()
469 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_BNO)) { in xchk_ag_btcur_init()
471 sa->bno_cur = xfs_allocbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
476 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_CNT)) { in xchk_ag_btcur_init()
478 sa->cnt_cur = xfs_allocbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
484 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_INO)) { in xchk_ag_btcur_init()
485 sa->ino_cur = xfs_inobt_init_cursor(mp, sc->tp, sa->agi_bp, in xchk_ag_btcur_init()
491 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_FINO)) { in xchk_ag_btcur_init()
492 sa->fino_cur = xfs_inobt_init_cursor(mp, sc->tp, sa->agi_bp, in xchk_ag_btcur_init()
498 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_RMAP)) { in xchk_ag_btcur_init()
499 sa->rmap_cur = xfs_rmapbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
505 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_REFC)) { in xchk_ag_btcur_init()
506 sa->refc_cur = xfs_refcountbt_init_cursor(mp, sc->tp, in xchk_ag_btcur_init()
514 struct xfs_scrub *sc, in xchk_ag_free() argument
519 xfs_trans_brelse(sc->tp, sa->agfl_bp); in xchk_ag_free()
523 xfs_trans_brelse(sc->tp, sa->agf_bp); in xchk_ag_free()
527 xfs_trans_brelse(sc->tp, sa->agi_bp); in xchk_ag_free()
545 struct xfs_scrub *sc, in xchk_ag_init() argument
551 error = xchk_ag_read_headers(sc, agno, sa); in xchk_ag_init()
555 xchk_ag_btcur_init(sc, sa); in xchk_ag_init()
573 struct xfs_scrub *sc, in xchk_trans_alloc() argument
576 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) in xchk_trans_alloc()
577 return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, in xchk_trans_alloc()
578 resblks, 0, 0, &sc->tp); in xchk_trans_alloc()
580 return xfs_trans_alloc_empty(sc->mp, &sc->tp); in xchk_trans_alloc()
586 struct xfs_scrub *sc) in xchk_setup_fs() argument
590 resblks = xrep_calc_ag_resblks(sc); in xchk_setup_fs()
591 return xchk_trans_alloc(sc, resblks); in xchk_setup_fs()
597 struct xfs_scrub *sc, in xchk_setup_ag_btree() argument
600 struct xfs_mount *mp = sc->mp; in xchk_setup_ag_btree()
615 error = xchk_setup_fs(sc); in xchk_setup_ag_btree()
619 return xchk_ag_init(sc, sc->sm->sm_agno, &sc->sa); in xchk_setup_ag_btree()
643 struct xfs_scrub *sc) in xchk_get_inode() argument
646 struct xfs_mount *mp = sc->mp; in xchk_get_inode()
647 struct xfs_inode *ip_in = XFS_I(file_inode(sc->file)); in xchk_get_inode()
652 if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) { in xchk_get_inode()
653 sc->ip = ip_in; in xchk_get_inode()
658 if (xfs_internal_inum(mp, sc->sm->sm_ino)) in xchk_get_inode()
660 error = xfs_iget(mp, NULL, sc->sm->sm_ino, in xchk_get_inode()
682 error = xfs_imap(sc->mp, sc->tp, sc->sm->sm_ino, &imap, in xchk_get_inode()
689 trace_xchk_op_error(sc, in xchk_get_inode()
690 XFS_INO_TO_AGNO(mp, sc->sm->sm_ino), in xchk_get_inode()
691 XFS_INO_TO_AGBNO(mp, sc->sm->sm_ino), in xchk_get_inode()
695 if (VFS_I(ip)->i_generation != sc->sm->sm_gen) { in xchk_get_inode()
700 sc->ip = ip; in xchk_get_inode()
707 struct xfs_scrub *sc, in xchk_setup_inode_contents() argument
712 error = xchk_get_inode(sc); in xchk_setup_inode_contents()
717 sc->ilock_flags = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL; in xchk_setup_inode_contents()
718 xfs_ilock(sc->ip, sc->ilock_flags); in xchk_setup_inode_contents()
719 error = xchk_trans_alloc(sc, resblks); in xchk_setup_inode_contents()
722 sc->ilock_flags |= XFS_ILOCK_EXCL; in xchk_setup_inode_contents()
723 xfs_ilock(sc->ip, XFS_ILOCK_EXCL); in xchk_setup_inode_contents()
737 struct xfs_scrub *sc, in xchk_should_check_xref() argument
742 if (xchk_skip_xref(sc->sm)) in xchk_should_check_xref()
758 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL; in xchk_should_check_xref()
759 trace_xchk_xref_error(sc, *error, __return_address); in xchk_should_check_xref()
772 struct xfs_scrub *sc, in xchk_buffer_recheck() argument
778 xchk_block_set_corrupt(sc, bp); in xchk_buffer_recheck()
782 xchk_set_incomplete(sc); in xchk_buffer_recheck()
788 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_buffer_recheck()
789 trace_xchk_block_error(sc, xfs_buf_daddr(bp), fa); in xchk_buffer_recheck()
798 struct xfs_scrub *sc) in xchk_metadata_inode_forks() argument
804 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_metadata_inode_forks()
808 if (sc->ip->i_diflags & XFS_DIFLAG_REALTIME) { in xchk_metadata_inode_forks()
809 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
814 if (xfs_is_reflink_inode(sc->ip)) { in xchk_metadata_inode_forks()
815 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
820 if (xfs_inode_hasattr(sc->ip)) { in xchk_metadata_inode_forks()
821 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
826 smtype = sc->sm->sm_type; in xchk_metadata_inode_forks()
827 sc->sm->sm_type = XFS_SCRUB_TYPE_BMBTD; in xchk_metadata_inode_forks()
828 error = xchk_bmap_data(sc); in xchk_metadata_inode_forks()
829 sc->sm->sm_type = smtype; in xchk_metadata_inode_forks()
830 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
834 if (xfs_has_reflink(sc->mp)) { in xchk_metadata_inode_forks()
835 error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip, in xchk_metadata_inode_forks()
837 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, in xchk_metadata_inode_forks()
841 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
872 struct xfs_scrub *sc) in xchk_stop_reaping() argument
874 sc->flags |= XCHK_REAPING_DISABLED; in xchk_stop_reaping()
875 xfs_blockgc_stop(sc->mp); in xchk_stop_reaping()
876 xfs_inodegc_stop(sc->mp); in xchk_stop_reaping()
882 struct xfs_scrub *sc) in xchk_start_reaping() argument
888 if (!xfs_is_readonly(sc->mp)) { in xchk_start_reaping()
889 xfs_inodegc_start(sc->mp); in xchk_start_reaping()
890 xfs_blockgc_start(sc->mp); in xchk_start_reaping()
892 sc->flags &= ~XCHK_REAPING_DISABLED; in xchk_start_reaping()