Lines Matching refs:sc

67 	struct xfs_scrub	*sc,  in __xchk_process_error()  argument
81 sc->ip ? sc->ip : XFS_I(file_inode(sc->file)), in __xchk_process_error()
82 sc->sm, *error); in __xchk_process_error()
87 sc->sm->sm_flags |= errflag; in __xchk_process_error()
91 trace_xchk_op_error(sc, agno, bno, *error, in __xchk_process_error()
100 struct xfs_scrub *sc, in xchk_process_error() argument
105 return __xchk_process_error(sc, agno, bno, error, in xchk_process_error()
111 struct xfs_scrub *sc, in xchk_xref_process_error() argument
116 return __xchk_process_error(sc, agno, bno, error, in xchk_xref_process_error()
123 struct xfs_scrub *sc, in __xchk_fblock_process_error() argument
136 trace_xchk_deadlock_retry(sc->ip, sc->sm, *error); in __xchk_fblock_process_error()
141 sc->sm->sm_flags |= errflag; in __xchk_fblock_process_error()
145 trace_xchk_file_op_error(sc, whichfork, offset, *error, in __xchk_fblock_process_error()
154 struct xfs_scrub *sc, in xchk_fblock_process_error() argument
159 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_process_error()
165 struct xfs_scrub *sc, in xchk_fblock_xref_process_error() argument
170 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_xref_process_error()
189 struct xfs_scrub *sc, in xchk_block_set_preen() argument
192 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_block_set_preen()
193 trace_xchk_block_preen(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_preen()
203 struct xfs_scrub *sc, in xchk_ino_set_preen() argument
206 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_ino_set_preen()
207 trace_xchk_ino_preen(sc, ino, __return_address); in xchk_ino_set_preen()
213 struct xfs_scrub *sc) in xchk_set_corrupt() argument
215 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_set_corrupt()
216 trace_xchk_fs_error(sc, 0, __return_address); in xchk_set_corrupt()
222 struct xfs_scrub *sc, in xchk_block_set_corrupt() argument
225 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_block_set_corrupt()
226 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_corrupt()
232 struct xfs_scrub *sc, in xchk_block_xref_set_corrupt() argument
235 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_block_xref_set_corrupt()
236 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_xref_set_corrupt()
246 struct xfs_scrub *sc, in xchk_ino_set_corrupt() argument
249 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_ino_set_corrupt()
250 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_set_corrupt()
256 struct xfs_scrub *sc, in xchk_ino_xref_set_corrupt() argument
259 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_ino_xref_set_corrupt()
260 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_xref_set_corrupt()
266 struct xfs_scrub *sc, in xchk_fblock_set_corrupt() argument
270 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_fblock_set_corrupt()
271 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_set_corrupt()
277 struct xfs_scrub *sc, in xchk_fblock_xref_set_corrupt() argument
281 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_fblock_xref_set_corrupt()
282 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_xref_set_corrupt()
291 struct xfs_scrub *sc, in xchk_ino_set_warning() argument
294 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_ino_set_warning()
295 trace_xchk_ino_warning(sc, ino, __return_address); in xchk_ino_set_warning()
301 struct xfs_scrub *sc, in xchk_fblock_set_warning() argument
305 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_fblock_set_warning()
306 trace_xchk_fblock_warning(sc, whichfork, offset, __return_address); in xchk_fblock_set_warning()
312 struct xfs_scrub *sc) in xchk_set_incomplete() argument
314 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_INCOMPLETE; in xchk_set_incomplete()
315 trace_xchk_incomplete(sc, __return_address); in xchk_set_incomplete()
356 struct xfs_scrub *sc, in xchk_count_rmap_ownedby_ag() argument
382 struct xfs_scrub *sc, in want_ag_read_header_failure() argument
386 if (sc->sm->sm_type != XFS_SCRUB_TYPE_AGF && in want_ag_read_header_failure()
387 sc->sm->sm_type != XFS_SCRUB_TYPE_AGFL && in want_ag_read_header_failure()
388 sc->sm->sm_type != XFS_SCRUB_TYPE_AGI) in want_ag_read_header_failure()
395 if (sc->sm->sm_type == type) in want_ag_read_header_failure()
409 struct xfs_scrub *sc, in xchk_perag_read_headers() argument
414 error = xfs_ialloc_read_agi(sa->pag, sc->tp, &sa->agi_bp); in xchk_perag_read_headers()
415 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI)) in xchk_perag_read_headers()
418 error = xfs_alloc_read_agf(sa->pag, sc->tp, 0, &sa->agf_bp); in xchk_perag_read_headers()
419 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGF)) in xchk_perag_read_headers()
431 struct xfs_scrub *sc) in xchk_perag_drain_and_lock() argument
433 struct xchk_ag *sa = &sc->sa; in xchk_perag_drain_and_lock()
441 if (xchk_should_terminate(sc, &error)) in xchk_perag_drain_and_lock()
444 error = xchk_perag_read_headers(sc, sa); in xchk_perag_drain_and_lock()
453 if (sc->ip) in xchk_perag_drain_and_lock()
483 xfs_trans_brelse(sc->tp, sa->agf_bp); in xchk_perag_drain_and_lock()
488 xfs_trans_brelse(sc->tp, sa->agi_bp); in xchk_perag_drain_and_lock()
492 if (!(sc->flags & XCHK_FSGATES_DRAIN)) in xchk_perag_drain_and_lock()
509 struct xfs_scrub *sc, in xchk_ag_read_headers() argument
513 struct xfs_mount *mp = sc->mp; in xchk_ag_read_headers()
520 return xchk_perag_drain_and_lock(sc); in xchk_ag_read_headers()
552 struct xfs_scrub *sc, in xchk_ag_btcur_init() argument
555 struct xfs_mount *mp = sc->mp; in xchk_ag_btcur_init()
558 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_BNO)) { in xchk_ag_btcur_init()
560 sa->bno_cur = xfs_allocbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
565 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_CNT)) { in xchk_ag_btcur_init()
567 sa->cnt_cur = xfs_allocbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
573 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_INO)) { in xchk_ag_btcur_init()
574 sa->ino_cur = xfs_inobt_init_cursor(sa->pag, sc->tp, sa->agi_bp, in xchk_ag_btcur_init()
580 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_FINO)) { in xchk_ag_btcur_init()
581 sa->fino_cur = xfs_inobt_init_cursor(sa->pag, sc->tp, sa->agi_bp, in xchk_ag_btcur_init()
587 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_RMAP)) { in xchk_ag_btcur_init()
588 sa->rmap_cur = xfs_rmapbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
594 xchk_ag_btree_healthy_enough(sc, sa->pag, XFS_BTNUM_REFC)) { in xchk_ag_btcur_init()
595 sa->refc_cur = xfs_refcountbt_init_cursor(mp, sc->tp, in xchk_ag_btcur_init()
603 struct xfs_scrub *sc, in xchk_ag_free() argument
608 xfs_trans_brelse(sc->tp, sa->agf_bp); in xchk_ag_free()
612 xfs_trans_brelse(sc->tp, sa->agi_bp); in xchk_ag_free()
630 struct xfs_scrub *sc, in xchk_ag_init() argument
636 error = xchk_ag_read_headers(sc, agno, sa); in xchk_ag_init()
640 xchk_ag_btcur_init(sc, sa); in xchk_ag_init()
648 struct xfs_scrub *sc) in xchk_trans_cancel() argument
650 xfs_trans_cancel(sc->tp); in xchk_trans_cancel()
651 sc->tp = NULL; in xchk_trans_cancel()
666 struct xfs_scrub *sc, in xchk_trans_alloc() argument
669 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) in xchk_trans_alloc()
670 return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, in xchk_trans_alloc()
671 resblks, 0, 0, &sc->tp); in xchk_trans_alloc()
673 return xfs_trans_alloc_empty(sc->mp, &sc->tp); in xchk_trans_alloc()
679 struct xfs_scrub *sc) in xchk_setup_fs() argument
683 resblks = xrep_calc_ag_resblks(sc); in xchk_setup_fs()
684 return xchk_trans_alloc(sc, resblks); in xchk_setup_fs()
690 struct xfs_scrub *sc, in xchk_setup_ag_btree() argument
693 struct xfs_mount *mp = sc->mp; in xchk_setup_ag_btree()
708 error = xchk_setup_fs(sc); in xchk_setup_ag_btree()
712 return xchk_ag_init(sc, sc->sm->sm_agno, &sc->sa); in xchk_setup_ag_btree()
732 struct xfs_scrub *sc, in xchk_iget() argument
736 return xfs_iget(sc->mp, sc->tp, inum, XFS_IGET_UNTRUSTED, 0, ipp); in xchk_iget()
757 struct xfs_scrub *sc, in xchk_iget_agi() argument
762 struct xfs_mount *mp = sc->mp; in xchk_iget_agi()
763 struct xfs_trans *tp = sc->tp; in xchk_iget_agi()
767 ASSERT(sc->tp != NULL); in xchk_iget_agi()
774 if (xchk_should_terminate(sc, &error)) in xchk_iget_agi()
822 struct xfs_scrub *sc, in xchk_install_handle_inode() argument
825 if (VFS_I(ip)->i_generation != sc->sm->sm_gen) { in xchk_install_handle_inode()
826 xchk_irele(sc, ip); in xchk_install_handle_inode()
830 sc->ip = ip; in xchk_install_handle_inode()
841 struct xfs_scrub *sc, in xchk_install_live_inode() argument
845 xchk_ino_set_corrupt(sc, ip->i_ino); in xchk_install_live_inode()
849 sc->ip = ip; in xchk_install_live_inode()
862 struct xfs_scrub *sc) in xchk_iget_for_scrubbing() argument
865 struct xfs_mount *mp = sc->mp; in xchk_iget_for_scrubbing()
868 struct xfs_inode *ip_in = XFS_I(file_inode(sc->file)); in xchk_iget_for_scrubbing()
870 xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, sc->sm->sm_ino); in xchk_iget_for_scrubbing()
873 ASSERT(sc->tp == NULL); in xchk_iget_for_scrubbing()
876 if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) in xchk_iget_for_scrubbing()
877 return xchk_install_live_inode(sc, ip_in); in xchk_iget_for_scrubbing()
880 if (xfs_internal_inum(mp, sc->sm->sm_ino)) in xchk_iget_for_scrubbing()
882 if (!xfs_verify_ino(sc->mp, sc->sm->sm_ino)) in xchk_iget_for_scrubbing()
886 error = xchk_iget(sc, sc->sm->sm_ino, &ip); in xchk_iget_for_scrubbing()
888 return xchk_install_handle_inode(sc, ip); in xchk_iget_for_scrubbing()
909 error = xchk_trans_alloc(sc, 0); in xchk_iget_for_scrubbing()
913 error = xchk_iget_agi(sc, sc->sm->sm_ino, &agi_bp, &ip); in xchk_iget_for_scrubbing()
916 xchk_trans_cancel(sc); in xchk_iget_for_scrubbing()
917 return xchk_install_handle_inode(sc, ip); in xchk_iget_for_scrubbing()
947 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, sc->sm->sm_ino)); in xchk_iget_for_scrubbing()
953 error = xfs_imap(pag, sc->tp, sc->sm->sm_ino, &imap, in xchk_iget_for_scrubbing()
962 xchk_trans_cancel(sc); in xchk_iget_for_scrubbing()
964 trace_xchk_op_error(sc, agno, XFS_INO_TO_AGBNO(mp, sc->sm->sm_ino), in xchk_iget_for_scrubbing()
969 xchk_trans_cancel(sc); in xchk_iget_for_scrubbing()
976 struct xfs_scrub *sc, in xchk_irele() argument
980 ASSERT(current->journal_info == sc->tp); in xchk_irele()
1015 struct xfs_scrub *sc, in xchk_setup_inode_contents() argument
1020 error = xchk_iget_for_scrubbing(sc); in xchk_setup_inode_contents()
1025 xchk_ilock(sc, XFS_IOLOCK_EXCL); in xchk_setup_inode_contents()
1027 error = xchk_trans_alloc(sc, resblks); in xchk_setup_inode_contents()
1030 xchk_ilock(sc, XFS_ILOCK_EXCL); in xchk_setup_inode_contents()
1038 struct xfs_scrub *sc, in xchk_ilock() argument
1041 xfs_ilock(sc->ip, ilock_flags); in xchk_ilock()
1042 sc->ilock_flags |= ilock_flags; in xchk_ilock()
1047 struct xfs_scrub *sc, in xchk_ilock_nowait() argument
1050 if (xfs_ilock_nowait(sc->ip, ilock_flags)) { in xchk_ilock_nowait()
1051 sc->ilock_flags |= ilock_flags; in xchk_ilock_nowait()
1060 struct xfs_scrub *sc, in xchk_iunlock() argument
1063 sc->ilock_flags &= ~ilock_flags; in xchk_iunlock()
1064 xfs_iunlock(sc->ip, ilock_flags); in xchk_iunlock()
1074 struct xfs_scrub *sc, in xchk_should_check_xref() argument
1079 if (xchk_skip_xref(sc->sm)) in xchk_should_check_xref()
1095 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL; in xchk_should_check_xref()
1096 trace_xchk_xref_error(sc, *error, __return_address); in xchk_should_check_xref()
1109 struct xfs_scrub *sc, in xchk_buffer_recheck() argument
1115 xchk_block_set_corrupt(sc, bp); in xchk_buffer_recheck()
1119 xchk_set_incomplete(sc); in xchk_buffer_recheck()
1125 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_buffer_recheck()
1126 trace_xchk_block_error(sc, xfs_buf_daddr(bp), fa); in xchk_buffer_recheck()
1131 struct xfs_scrub *sc, in xchk_metadata_inode_subtype() argument
1134 __u32 smtype = sc->sm->sm_type; in xchk_metadata_inode_subtype()
1137 sc->sm->sm_type = scrub_type; in xchk_metadata_inode_subtype()
1141 error = xchk_inode(sc); in xchk_metadata_inode_subtype()
1144 error = xchk_bmap_data(sc); in xchk_metadata_inode_subtype()
1152 sc->sm->sm_type = smtype; in xchk_metadata_inode_subtype()
1162 struct xfs_scrub *sc) in xchk_metadata_inode_forks() argument
1167 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_metadata_inode_forks()
1171 error = xchk_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_INODE); in xchk_metadata_inode_forks()
1172 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
1176 if (sc->ip->i_diflags & XFS_DIFLAG_REALTIME) { in xchk_metadata_inode_forks()
1177 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1182 if (xfs_is_reflink_inode(sc->ip)) { in xchk_metadata_inode_forks()
1183 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1188 if (xfs_inode_hasattr(sc->ip)) { in xchk_metadata_inode_forks()
1189 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1194 error = xchk_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_BMBTD); in xchk_metadata_inode_forks()
1195 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
1199 if (xfs_has_reflink(sc->mp)) { in xchk_metadata_inode_forks()
1200 error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip, in xchk_metadata_inode_forks()
1202 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, in xchk_metadata_inode_forks()
1206 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1220 struct xfs_scrub *sc, in xchk_fsgates_enable() argument
1224 ASSERT(!(sc->flags & scrub_fsgates)); in xchk_fsgates_enable()
1226 trace_xchk_fsgates_enable(sc, scrub_fsgates); in xchk_fsgates_enable()
1231 sc->flags |= scrub_fsgates; in xchk_fsgates_enable()
1252 struct xfs_scrub *sc, in xchk_inode_is_allocated() argument
1256 struct xfs_mount *mp = sc->mp; in xchk_inode_is_allocated()
1257 struct xfs_perag *pag = sc->sa.pag; in xchk_inode_is_allocated()
1269 if (sc->sa.agi_bp == NULL) { in xchk_inode_is_allocated()
1270 ASSERT(sc->sa.agi_bp != NULL); in xchk_inode_is_allocated()
1275 ino = XFS_AGINO_TO_INO(sc->mp, pag->pag_agno, agino); in xchk_inode_is_allocated()