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()
459 struct xfs_scrub *sc, in xchk_ag_btcur_init() argument
462 struct xfs_mount *mp = sc->mp; in xchk_ag_btcur_init()
465 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_BNO)) { in xchk_ag_btcur_init()
467 sa->bno_cur = xfs_allocbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
472 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_CNT)) { in xchk_ag_btcur_init()
474 sa->cnt_cur = xfs_allocbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
480 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_INO)) { in xchk_ag_btcur_init()
481 sa->ino_cur = xfs_inobt_init_cursor(sa->pag, sc->tp, sa->agi_bp, in xchk_ag_btcur_init()
487 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_FINO)) { in xchk_ag_btcur_init()
488 sa->fino_cur = xfs_inobt_init_cursor(sa->pag, sc->tp, sa->agi_bp, in xchk_ag_btcur_init()
494 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_RMAP)) { in xchk_ag_btcur_init()
495 sa->rmap_cur = xfs_rmapbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
501 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_REFC)) { in xchk_ag_btcur_init()
502 sa->refc_cur = xfs_refcountbt_init_cursor(mp, sc->tp, in xchk_ag_btcur_init()
510 struct xfs_scrub *sc, in xchk_ag_free() argument
515 xfs_trans_brelse(sc->tp, sa->agf_bp); in xchk_ag_free()
519 xfs_trans_brelse(sc->tp, sa->agi_bp); in xchk_ag_free()
537 struct xfs_scrub *sc, in xchk_ag_init() argument
543 error = xchk_ag_read_headers(sc, agno, sa); in xchk_ag_init()
547 xchk_ag_btcur_init(sc, sa); in xchk_ag_init()
565 struct xfs_scrub *sc, in xchk_trans_alloc() argument
568 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) in xchk_trans_alloc()
569 return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, in xchk_trans_alloc()
570 resblks, 0, 0, &sc->tp); in xchk_trans_alloc()
572 return xfs_trans_alloc_empty(sc->mp, &sc->tp); in xchk_trans_alloc()
578 struct xfs_scrub *sc) in xchk_setup_fs() argument
582 resblks = xrep_calc_ag_resblks(sc); in xchk_setup_fs()
583 return xchk_trans_alloc(sc, resblks); in xchk_setup_fs()
589 struct xfs_scrub *sc, in xchk_setup_ag_btree() argument
592 struct xfs_mount *mp = sc->mp; in xchk_setup_ag_btree()
607 error = xchk_setup_fs(sc); in xchk_setup_ag_btree()
611 return xchk_ag_init(sc, sc->sm->sm_agno, &sc->sa); in xchk_setup_ag_btree()
635 struct xfs_scrub *sc) in xchk_get_inode() argument
638 struct xfs_mount *mp = sc->mp; in xchk_get_inode()
640 struct xfs_inode *ip_in = XFS_I(file_inode(sc->file)); in xchk_get_inode()
645 if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) { in xchk_get_inode()
646 sc->ip = ip_in; in xchk_get_inode()
651 if (xfs_internal_inum(mp, sc->sm->sm_ino)) in xchk_get_inode()
653 error = xfs_iget(mp, NULL, sc->sm->sm_ino, in xchk_get_inode()
675 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, sc->sm->sm_ino)); in xchk_get_inode()
677 error = xfs_imap(pag, sc->tp, sc->sm->sm_ino, &imap, in xchk_get_inode()
686 trace_xchk_op_error(sc, in xchk_get_inode()
687 XFS_INO_TO_AGNO(mp, sc->sm->sm_ino), in xchk_get_inode()
688 XFS_INO_TO_AGBNO(mp, sc->sm->sm_ino), in xchk_get_inode()
692 if (VFS_I(ip)->i_generation != sc->sm->sm_gen) { in xchk_get_inode()
697 sc->ip = ip; in xchk_get_inode()
704 struct xfs_scrub *sc, in xchk_setup_inode_contents() argument
709 error = xchk_get_inode(sc); in xchk_setup_inode_contents()
714 sc->ilock_flags = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL; in xchk_setup_inode_contents()
715 xfs_ilock(sc->ip, sc->ilock_flags); in xchk_setup_inode_contents()
716 error = xchk_trans_alloc(sc, resblks); in xchk_setup_inode_contents()
719 sc->ilock_flags |= XFS_ILOCK_EXCL; in xchk_setup_inode_contents()
720 xfs_ilock(sc->ip, XFS_ILOCK_EXCL); in xchk_setup_inode_contents()
734 struct xfs_scrub *sc, in xchk_should_check_xref() argument
739 if (xchk_skip_xref(sc->sm)) in xchk_should_check_xref()
755 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL; in xchk_should_check_xref()
756 trace_xchk_xref_error(sc, *error, __return_address); in xchk_should_check_xref()
769 struct xfs_scrub *sc, in xchk_buffer_recheck() argument
775 xchk_block_set_corrupt(sc, bp); in xchk_buffer_recheck()
779 xchk_set_incomplete(sc); in xchk_buffer_recheck()
785 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_buffer_recheck()
786 trace_xchk_block_error(sc, xfs_buf_daddr(bp), fa); in xchk_buffer_recheck()
791 struct xfs_scrub *sc, in xchk_metadata_inode_subtype() argument
794 __u32 smtype = sc->sm->sm_type; in xchk_metadata_inode_subtype()
797 sc->sm->sm_type = scrub_type; in xchk_metadata_inode_subtype()
801 error = xchk_inode(sc); in xchk_metadata_inode_subtype()
804 error = xchk_bmap_data(sc); in xchk_metadata_inode_subtype()
812 sc->sm->sm_type = smtype; in xchk_metadata_inode_subtype()
822 struct xfs_scrub *sc) in xchk_metadata_inode_forks() argument
827 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_metadata_inode_forks()
831 error = xchk_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_INODE); in xchk_metadata_inode_forks()
832 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
836 if (sc->ip->i_diflags & XFS_DIFLAG_REALTIME) { in xchk_metadata_inode_forks()
837 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
842 if (xfs_is_reflink_inode(sc->ip)) { in xchk_metadata_inode_forks()
843 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
848 if (xfs_inode_hasattr(sc->ip)) { in xchk_metadata_inode_forks()
849 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
854 error = xchk_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_BMBTD); in xchk_metadata_inode_forks()
855 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
859 if (xfs_has_reflink(sc->mp)) { in xchk_metadata_inode_forks()
860 error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip, in xchk_metadata_inode_forks()
862 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, in xchk_metadata_inode_forks()
866 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
897 struct xfs_scrub *sc) in xchk_stop_reaping() argument
899 sc->flags |= XCHK_REAPING_DISABLED; in xchk_stop_reaping()
900 xfs_blockgc_stop(sc->mp); in xchk_stop_reaping()
901 xfs_inodegc_stop(sc->mp); in xchk_stop_reaping()
907 struct xfs_scrub *sc) in xchk_start_reaping() argument
913 if (!xfs_is_readonly(sc->mp)) { in xchk_start_reaping()
914 xfs_inodegc_start(sc->mp); in xchk_start_reaping()
915 xfs_blockgc_start(sc->mp); in xchk_start_reaping()
917 sc->flags &= ~XCHK_REAPING_DISABLED; in xchk_start_reaping()