Lines Matching refs:sc
73 struct xfs_scrub *sc, in __xchk_process_error() argument
87 sc->ip ? sc->ip : XFS_I(file_inode(sc->file)), in __xchk_process_error()
88 sc->sm, *error); in __xchk_process_error()
96 trace_xchk_op_error(sc, agno, bno, *error, ret_ip); in __xchk_process_error()
102 sc->sm->sm_flags |= errflag; in __xchk_process_error()
106 trace_xchk_op_error(sc, agno, bno, *error, ret_ip); in __xchk_process_error()
114 struct xfs_scrub *sc, in xchk_process_error() argument
119 return __xchk_process_error(sc, agno, bno, error, in xchk_process_error()
125 struct xfs_scrub *sc, in xchk_xref_process_error() argument
130 return __xchk_process_error(sc, agno, bno, error, in xchk_xref_process_error()
137 struct xfs_scrub *sc, in __xchk_fblock_process_error() argument
150 trace_xchk_deadlock_retry(sc->ip, sc->sm, *error); in __xchk_fblock_process_error()
158 trace_xchk_file_op_error(sc, whichfork, offset, *error, in __xchk_fblock_process_error()
165 sc->sm->sm_flags |= errflag; in __xchk_fblock_process_error()
169 trace_xchk_file_op_error(sc, whichfork, offset, *error, in __xchk_fblock_process_error()
178 struct xfs_scrub *sc, in xchk_fblock_process_error() argument
183 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_process_error()
189 struct xfs_scrub *sc, in xchk_fblock_xref_process_error() argument
194 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_xref_process_error()
213 struct xfs_scrub *sc, in xchk_block_set_preen() argument
216 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_block_set_preen()
217 trace_xchk_block_preen(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_preen()
227 struct xfs_scrub *sc, in xchk_ino_set_preen() argument
230 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_ino_set_preen()
231 trace_xchk_ino_preen(sc, ino, __return_address); in xchk_ino_set_preen()
237 struct xfs_scrub *sc) in xchk_set_corrupt() argument
239 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_set_corrupt()
240 trace_xchk_fs_error(sc, 0, __return_address); in xchk_set_corrupt()
246 struct xfs_scrub *sc, in xchk_block_set_corrupt() argument
249 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_block_set_corrupt()
250 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_corrupt()
257 struct xfs_scrub *sc, in xchk_qcheck_set_corrupt() argument
261 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_qcheck_set_corrupt()
262 trace_xchk_qcheck_error(sc, dqtype, id, __return_address); in xchk_qcheck_set_corrupt()
269 struct xfs_scrub *sc, in xchk_block_xref_set_corrupt() argument
272 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_block_xref_set_corrupt()
273 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_xref_set_corrupt()
283 struct xfs_scrub *sc, in xchk_ino_set_corrupt() argument
286 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_ino_set_corrupt()
287 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_set_corrupt()
293 struct xfs_scrub *sc, in xchk_ino_xref_set_corrupt() argument
296 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_ino_xref_set_corrupt()
297 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_xref_set_corrupt()
303 struct xfs_scrub *sc, in xchk_fblock_set_corrupt() argument
307 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_fblock_set_corrupt()
308 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_set_corrupt()
314 struct xfs_scrub *sc, in xchk_fblock_xref_set_corrupt() argument
318 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_fblock_xref_set_corrupt()
319 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_xref_set_corrupt()
328 struct xfs_scrub *sc, in xchk_ino_set_warning() argument
331 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_ino_set_warning()
332 trace_xchk_ino_warning(sc, ino, __return_address); in xchk_ino_set_warning()
338 struct xfs_scrub *sc, in xchk_fblock_set_warning() argument
342 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_fblock_set_warning()
343 trace_xchk_fblock_warning(sc, whichfork, offset, __return_address); in xchk_fblock_set_warning()
349 struct xfs_scrub *sc) in xchk_set_incomplete() argument
351 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_INCOMPLETE; in xchk_set_incomplete()
352 trace_xchk_incomplete(sc, __return_address); in xchk_set_incomplete()
393 struct xfs_scrub *sc, in xchk_count_rmap_ownedby_ag() argument
419 struct xfs_scrub *sc, in want_ag_read_header_failure() argument
423 if (sc->sm->sm_type != XFS_SCRUB_TYPE_AGF && in want_ag_read_header_failure()
424 sc->sm->sm_type != XFS_SCRUB_TYPE_AGFL && in want_ag_read_header_failure()
425 sc->sm->sm_type != XFS_SCRUB_TYPE_AGI) in want_ag_read_header_failure()
432 if (sc->sm->sm_type == type) in want_ag_read_header_failure()
446 struct xfs_scrub *sc, in xchk_perag_read_headers() argument
451 error = xfs_ialloc_read_agi(sa->pag, sc->tp, 0, &sa->agi_bp); in xchk_perag_read_headers()
452 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI)) in xchk_perag_read_headers()
455 error = xfs_alloc_read_agf(sa->pag, sc->tp, 0, &sa->agf_bp); in xchk_perag_read_headers()
456 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGF)) in xchk_perag_read_headers()
468 struct xfs_scrub *sc) in xchk_perag_drain_and_lock() argument
470 struct xchk_ag *sa = &sc->sa; in xchk_perag_drain_and_lock()
478 if (xchk_should_terminate(sc, &error)) in xchk_perag_drain_and_lock()
481 error = xchk_perag_read_headers(sc, sa); in xchk_perag_drain_and_lock()
490 if (sc->ip) in xchk_perag_drain_and_lock()
520 xfs_trans_brelse(sc->tp, sa->agf_bp); in xchk_perag_drain_and_lock()
525 xfs_trans_brelse(sc->tp, sa->agi_bp); in xchk_perag_drain_and_lock()
529 if (!(sc->flags & XCHK_FSGATES_DRAIN)) in xchk_perag_drain_and_lock()
546 struct xfs_scrub *sc, in xchk_ag_read_headers() argument
550 struct xfs_mount *mp = sc->mp; in xchk_ag_read_headers()
557 return xchk_perag_drain_and_lock(sc); in xchk_ag_read_headers()
589 struct xfs_scrub *sc, in xchk_ag_btcur_init() argument
592 struct xfs_mount *mp = sc->mp; in xchk_ag_btcur_init()
596 sa->bno_cur = xfs_bnobt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
598 xchk_ag_btree_del_cursor_if_sick(sc, &sa->bno_cur, in xchk_ag_btcur_init()
602 sa->cnt_cur = xfs_cntbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
604 xchk_ag_btree_del_cursor_if_sick(sc, &sa->cnt_cur, in xchk_ag_btcur_init()
609 sa->rmap_cur = xfs_rmapbt_init_cursor(mp, sc->tp, in xchk_ag_btcur_init()
611 xchk_ag_btree_del_cursor_if_sick(sc, &sa->rmap_cur, in xchk_ag_btcur_init()
617 sa->refc_cur = xfs_refcountbt_init_cursor(mp, sc->tp, in xchk_ag_btcur_init()
619 xchk_ag_btree_del_cursor_if_sick(sc, &sa->refc_cur, in xchk_ag_btcur_init()
626 sa->ino_cur = xfs_inobt_init_cursor(sa->pag, sc->tp, in xchk_ag_btcur_init()
628 xchk_ag_btree_del_cursor_if_sick(sc, &sa->ino_cur, in xchk_ag_btcur_init()
633 sa->fino_cur = xfs_finobt_init_cursor(sa->pag, sc->tp, in xchk_ag_btcur_init()
635 xchk_ag_btree_del_cursor_if_sick(sc, &sa->fino_cur, in xchk_ag_btcur_init()
644 struct xfs_scrub *sc, in xchk_ag_free() argument
648 xrep_reset_perag_resv(sc); in xchk_ag_free()
650 xfs_trans_brelse(sc->tp, sa->agf_bp); in xchk_ag_free()
654 xfs_trans_brelse(sc->tp, sa->agi_bp); in xchk_ag_free()
672 struct xfs_scrub *sc, in xchk_ag_init() argument
678 error = xchk_ag_read_headers(sc, agno, sa); in xchk_ag_init()
682 xchk_ag_btcur_init(sc, sa); in xchk_ag_init()
690 struct xfs_scrub *sc) in xchk_trans_cancel() argument
692 xfs_trans_cancel(sc->tp); in xchk_trans_cancel()
693 sc->tp = NULL; in xchk_trans_cancel()
698 struct xfs_scrub *sc) in xchk_trans_alloc_empty() argument
700 return xfs_trans_alloc_empty(sc->mp, &sc->tp); in xchk_trans_alloc_empty()
715 struct xfs_scrub *sc, in xchk_trans_alloc() argument
718 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) in xchk_trans_alloc()
719 return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, in xchk_trans_alloc()
720 resblks, 0, 0, &sc->tp); in xchk_trans_alloc()
722 return xchk_trans_alloc_empty(sc); in xchk_trans_alloc()
728 struct xfs_scrub *sc) in xchk_setup_fs() argument
732 resblks = xrep_calc_ag_resblks(sc); in xchk_setup_fs()
733 return xchk_trans_alloc(sc, resblks); in xchk_setup_fs()
739 struct xfs_scrub *sc, in xchk_setup_ag_btree() argument
742 struct xfs_mount *mp = sc->mp; in xchk_setup_ag_btree()
757 error = xchk_setup_fs(sc); in xchk_setup_ag_btree()
761 return xchk_ag_init(sc, sc->sm->sm_agno, &sc->sa); in xchk_setup_ag_btree()
781 struct xfs_scrub *sc, in xchk_iget() argument
785 ASSERT(sc->tp != NULL); in xchk_iget()
787 return xfs_iget(sc->mp, sc->tp, inum, XCHK_IGET_FLAGS, 0, ipp); in xchk_iget()
808 struct xfs_scrub *sc, in xchk_iget_agi() argument
813 struct xfs_mount *mp = sc->mp; in xchk_iget_agi()
814 struct xfs_trans *tp = sc->tp; in xchk_iget_agi()
818 ASSERT(sc->tp != NULL); in xchk_iget_agi()
825 if (xchk_should_terminate(sc, &error)) in xchk_iget_agi()
878 struct xfs_scrub *sc) in xchk_ino_dqattach() argument
880 ASSERT(sc->tp != NULL); in xchk_ino_dqattach()
881 ASSERT(sc->ip != NULL); in xchk_ino_dqattach()
883 if (!xchk_could_repair(sc)) in xchk_ino_dqattach()
886 return xrep_ino_dqattach(sc); in xchk_ino_dqattach()
893 struct xfs_scrub *sc, in xchk_install_handle_inode() argument
896 if (VFS_I(ip)->i_generation != sc->sm->sm_gen) { in xchk_install_handle_inode()
897 xchk_irele(sc, ip); in xchk_install_handle_inode()
901 sc->ip = ip; in xchk_install_handle_inode()
912 struct xfs_scrub *sc, in xchk_install_live_inode() argument
916 xchk_ino_set_corrupt(sc, ip->i_ino); in xchk_install_live_inode()
920 sc->ip = ip; in xchk_install_live_inode()
933 struct xfs_scrub *sc) in xchk_iget_for_scrubbing() argument
936 struct xfs_mount *mp = sc->mp; in xchk_iget_for_scrubbing()
939 struct xfs_inode *ip_in = XFS_I(file_inode(sc->file)); in xchk_iget_for_scrubbing()
941 xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, sc->sm->sm_ino); in xchk_iget_for_scrubbing()
944 ASSERT(sc->tp == NULL); in xchk_iget_for_scrubbing()
947 if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) in xchk_iget_for_scrubbing()
948 return xchk_install_live_inode(sc, ip_in); in xchk_iget_for_scrubbing()
951 if (xfs_internal_inum(mp, sc->sm->sm_ino)) in xchk_iget_for_scrubbing()
953 if (!xfs_verify_ino(sc->mp, sc->sm->sm_ino)) in xchk_iget_for_scrubbing()
957 error = xchk_iget_safe(sc, sc->sm->sm_ino, &ip); in xchk_iget_for_scrubbing()
959 return xchk_install_handle_inode(sc, ip); in xchk_iget_for_scrubbing()
980 error = xchk_trans_alloc(sc, 0); in xchk_iget_for_scrubbing()
984 error = xchk_iget_agi(sc, sc->sm->sm_ino, &agi_bp, &ip); in xchk_iget_for_scrubbing()
987 xchk_trans_cancel(sc); in xchk_iget_for_scrubbing()
988 return xchk_install_handle_inode(sc, ip); in xchk_iget_for_scrubbing()
1018 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, sc->sm->sm_ino)); in xchk_iget_for_scrubbing()
1024 error = xfs_imap(pag, sc->tp, sc->sm->sm_ino, &imap, in xchk_iget_for_scrubbing()
1033 xchk_trans_cancel(sc); in xchk_iget_for_scrubbing()
1035 trace_xchk_op_error(sc, agno, XFS_INO_TO_AGBNO(mp, sc->sm->sm_ino), in xchk_iget_for_scrubbing()
1040 xchk_trans_cancel(sc); in xchk_iget_for_scrubbing()
1047 struct xfs_scrub *sc, in xchk_irele() argument
1050 if (sc->tp) { in xchk_irele()
1078 struct xfs_scrub *sc, in xchk_setup_inode_contents() argument
1083 error = xchk_iget_for_scrubbing(sc); in xchk_setup_inode_contents()
1088 xchk_ilock(sc, XFS_IOLOCK_EXCL); in xchk_setup_inode_contents()
1090 error = xchk_trans_alloc(sc, resblks); in xchk_setup_inode_contents()
1094 error = xchk_ino_dqattach(sc); in xchk_setup_inode_contents()
1098 xchk_ilock(sc, XFS_ILOCK_EXCL); in xchk_setup_inode_contents()
1106 struct xfs_scrub *sc, in xchk_ilock() argument
1109 xfs_ilock(sc->ip, ilock_flags); in xchk_ilock()
1110 sc->ilock_flags |= ilock_flags; in xchk_ilock()
1115 struct xfs_scrub *sc, in xchk_ilock_nowait() argument
1118 if (xfs_ilock_nowait(sc->ip, ilock_flags)) { in xchk_ilock_nowait()
1119 sc->ilock_flags |= ilock_flags; in xchk_ilock_nowait()
1128 struct xfs_scrub *sc, in xchk_iunlock() argument
1131 sc->ilock_flags &= ~ilock_flags; in xchk_iunlock()
1132 xfs_iunlock(sc->ip, ilock_flags); in xchk_iunlock()
1142 struct xfs_scrub *sc, in xchk_should_check_xref() argument
1147 if (xchk_skip_xref(sc->sm)) in xchk_should_check_xref()
1163 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL; in xchk_should_check_xref()
1164 trace_xchk_xref_error(sc, *error, __return_address); in xchk_should_check_xref()
1177 struct xfs_scrub *sc, in xchk_buffer_recheck() argument
1183 xchk_block_set_corrupt(sc, bp); in xchk_buffer_recheck()
1187 xchk_set_incomplete(sc); in xchk_buffer_recheck()
1193 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_buffer_recheck()
1194 trace_xchk_block_error(sc, xfs_buf_daddr(bp), fa); in xchk_buffer_recheck()
1199 struct xfs_scrub *sc, in xchk_metadata_inode_subtype() argument
1205 sub = xchk_scrub_create_subord(sc, scrub_type); in xchk_metadata_inode_subtype()
1206 error = sub->sc.ops->scrub(&sub->sc); in xchk_metadata_inode_subtype()
1217 struct xfs_scrub *sc) in xchk_metadata_inode_forks() argument
1222 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_metadata_inode_forks()
1226 error = xchk_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_INODE); in xchk_metadata_inode_forks()
1227 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
1231 if (sc->ip->i_diflags & XFS_DIFLAG_REALTIME) { in xchk_metadata_inode_forks()
1232 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1237 if (xfs_is_reflink_inode(sc->ip)) { in xchk_metadata_inode_forks()
1238 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1243 if (xfs_inode_hasattr(sc->ip)) { in xchk_metadata_inode_forks()
1244 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1249 error = xchk_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_BMBTD); in xchk_metadata_inode_forks()
1250 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
1254 if (xfs_has_reflink(sc->mp)) { in xchk_metadata_inode_forks()
1255 error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip, in xchk_metadata_inode_forks()
1257 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, in xchk_metadata_inode_forks()
1261 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1275 struct xfs_scrub *sc, in xchk_fsgates_enable() argument
1279 ASSERT(!(sc->flags & scrub_fsgates)); in xchk_fsgates_enable()
1281 trace_xchk_fsgates_enable(sc, scrub_fsgates); in xchk_fsgates_enable()
1295 sc->flags |= scrub_fsgates; in xchk_fsgates_enable()
1316 struct xfs_scrub *sc, in xchk_inode_is_allocated() argument
1320 struct xfs_mount *mp = sc->mp; in xchk_inode_is_allocated()
1321 struct xfs_perag *pag = sc->sa.pag; in xchk_inode_is_allocated()
1333 if (sc->sa.agi_bp == NULL) { in xchk_inode_is_allocated()
1334 ASSERT(sc->sa.agi_bp != NULL); in xchk_inode_is_allocated()
1339 ino = XFS_AGINO_TO_INO(sc->mp, pag->pag_agno, agino); in xchk_inode_is_allocated()