Lines Matching full:sc

78 	struct xfs_scrub	*sc,  in __xchk_process_error()  argument
92 sc->ip ? sc->ip : XFS_I(file_inode(sc->file)), in __xchk_process_error()
93 sc->sm, *error); in __xchk_process_error()
101 trace_xchk_op_error(sc, agno, bno, *error, ret_ip); in __xchk_process_error()
107 sc->sm->sm_flags |= errflag; in __xchk_process_error()
111 trace_xchk_op_error(sc, agno, bno, *error, ret_ip); in __xchk_process_error()
119 struct xfs_scrub *sc, in xchk_process_error() argument
124 return __xchk_process_error(sc, agno, bno, error, in xchk_process_error()
130 struct xfs_scrub *sc, in xchk_process_rt_error() argument
135 return __xchk_process_error(sc, rgno, rgbno, error, in xchk_process_rt_error()
141 struct xfs_scrub *sc, in xchk_xref_process_error() argument
146 return __xchk_process_error(sc, agno, bno, error, in xchk_xref_process_error()
153 struct xfs_scrub *sc, in __xchk_fblock_process_error() argument
166 trace_xchk_deadlock_retry(sc->ip, sc->sm, *error); in __xchk_fblock_process_error()
174 trace_xchk_file_op_error(sc, whichfork, offset, *error, in __xchk_fblock_process_error()
181 sc->sm->sm_flags |= errflag; in __xchk_fblock_process_error()
185 trace_xchk_file_op_error(sc, whichfork, offset, *error, in __xchk_fblock_process_error()
194 struct xfs_scrub *sc, in xchk_fblock_process_error() argument
199 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_process_error()
205 struct xfs_scrub *sc, in xchk_fblock_xref_process_error() argument
210 return __xchk_fblock_process_error(sc, whichfork, offset, error, in xchk_fblock_xref_process_error()
229 struct xfs_scrub *sc, in xchk_block_set_preen() argument
232 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_block_set_preen()
233 trace_xchk_block_preen(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_preen()
243 struct xfs_scrub *sc, in xchk_ino_set_preen() argument
246 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; in xchk_ino_set_preen()
247 trace_xchk_ino_preen(sc, ino, __return_address); in xchk_ino_set_preen()
253 struct xfs_scrub *sc) in xchk_set_corrupt() argument
255 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_set_corrupt()
256 trace_xchk_fs_error(sc, 0, __return_address); in xchk_set_corrupt()
262 struct xfs_scrub *sc, in xchk_block_set_corrupt() argument
265 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_block_set_corrupt()
266 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_set_corrupt()
273 struct xfs_scrub *sc, in xchk_qcheck_set_corrupt() argument
277 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_qcheck_set_corrupt()
278 trace_xchk_qcheck_error(sc, dqtype, id, __return_address); in xchk_qcheck_set_corrupt()
285 struct xfs_scrub *sc, in xchk_block_xref_set_corrupt() argument
288 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_block_xref_set_corrupt()
289 trace_xchk_block_error(sc, xfs_buf_daddr(bp), __return_address); in xchk_block_xref_set_corrupt()
299 struct xfs_scrub *sc, in xchk_ino_set_corrupt() argument
302 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_ino_set_corrupt()
303 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_set_corrupt()
309 struct xfs_scrub *sc, in xchk_ino_xref_set_corrupt() argument
312 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_ino_xref_set_corrupt()
313 trace_xchk_ino_error(sc, ino, __return_address); in xchk_ino_xref_set_corrupt()
319 struct xfs_scrub *sc, in xchk_fblock_set_corrupt() argument
323 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_fblock_set_corrupt()
324 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_set_corrupt()
330 struct xfs_scrub *sc, in xchk_fblock_xref_set_corrupt() argument
334 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; in xchk_fblock_xref_set_corrupt()
335 trace_xchk_fblock_error(sc, whichfork, offset, __return_address); in xchk_fblock_xref_set_corrupt()
344 struct xfs_scrub *sc, in xchk_ino_set_warning() argument
347 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_ino_set_warning()
348 trace_xchk_ino_warning(sc, ino, __return_address); in xchk_ino_set_warning()
354 struct xfs_scrub *sc, in xchk_fblock_set_warning() argument
358 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; in xchk_fblock_set_warning()
359 trace_xchk_fblock_warning(sc, whichfork, offset, __return_address); in xchk_fblock_set_warning()
365 struct xfs_scrub *sc) in xchk_set_incomplete() argument
367 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_INCOMPLETE; in xchk_set_incomplete()
368 trace_xchk_incomplete(sc, __return_address); in xchk_set_incomplete()
409 struct xfs_scrub *sc, in xchk_count_rmap_ownedby_ag() argument
435 struct xfs_scrub *sc, in want_ag_read_header_failure() argument
439 if (sc->sm->sm_type != XFS_SCRUB_TYPE_AGF && in want_ag_read_header_failure()
440 sc->sm->sm_type != XFS_SCRUB_TYPE_AGFL && in want_ag_read_header_failure()
441 sc->sm->sm_type != XFS_SCRUB_TYPE_AGI) in want_ag_read_header_failure()
448 if (sc->sm->sm_type == type) in want_ag_read_header_failure()
462 struct xfs_scrub *sc, in xchk_perag_read_headers() argument
467 error = xfs_ialloc_read_agi(sa->pag, sc->tp, 0, &sa->agi_bp); in xchk_perag_read_headers()
468 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGI)) in xchk_perag_read_headers()
471 error = xfs_alloc_read_agf(sa->pag, sc->tp, 0, &sa->agf_bp); in xchk_perag_read_headers()
472 if (error && want_ag_read_header_failure(sc, XFS_SCRUB_TYPE_AGF)) in xchk_perag_read_headers()
484 struct xfs_scrub *sc) in xchk_perag_drain_and_lock() argument
486 struct xchk_ag *sa = &sc->sa; in xchk_perag_drain_and_lock()
494 if (xchk_should_terminate(sc, &error)) in xchk_perag_drain_and_lock()
497 error = xchk_perag_read_headers(sc, sa); in xchk_perag_drain_and_lock()
506 if (sc->ip) in xchk_perag_drain_and_lock()
536 xfs_trans_brelse(sc->tp, sa->agf_bp); in xchk_perag_drain_and_lock()
541 xfs_trans_brelse(sc->tp, sa->agi_bp); in xchk_perag_drain_and_lock()
545 if (!(sc->flags & XCHK_FSGATES_DRAIN)) in xchk_perag_drain_and_lock()
562 struct xfs_scrub *sc, in xchk_ag_read_headers() argument
566 struct xfs_mount *mp = sc->mp; in xchk_ag_read_headers()
573 return xchk_perag_drain_and_lock(sc); in xchk_ag_read_headers()
605 struct xfs_scrub *sc, in xchk_ag_btcur_init() argument
608 struct xfs_mount *mp = sc->mp; in xchk_ag_btcur_init()
612 sa->bno_cur = xfs_bnobt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
614 xchk_ag_btree_del_cursor_if_sick(sc, &sa->bno_cur, in xchk_ag_btcur_init()
618 sa->cnt_cur = xfs_cntbt_init_cursor(mp, sc->tp, sa->agf_bp, in xchk_ag_btcur_init()
620 xchk_ag_btree_del_cursor_if_sick(sc, &sa->cnt_cur, in xchk_ag_btcur_init()
625 sa->rmap_cur = xfs_rmapbt_init_cursor(mp, sc->tp, in xchk_ag_btcur_init()
627 xchk_ag_btree_del_cursor_if_sick(sc, &sa->rmap_cur, in xchk_ag_btcur_init()
633 sa->refc_cur = xfs_refcountbt_init_cursor(mp, sc->tp, in xchk_ag_btcur_init()
635 xchk_ag_btree_del_cursor_if_sick(sc, &sa->refc_cur, in xchk_ag_btcur_init()
642 sa->ino_cur = xfs_inobt_init_cursor(sa->pag, sc->tp, in xchk_ag_btcur_init()
644 xchk_ag_btree_del_cursor_if_sick(sc, &sa->ino_cur, in xchk_ag_btcur_init()
649 sa->fino_cur = xfs_finobt_init_cursor(sa->pag, sc->tp, in xchk_ag_btcur_init()
651 xchk_ag_btree_del_cursor_if_sick(sc, &sa->fino_cur, in xchk_ag_btcur_init()
660 struct xfs_scrub *sc, in xchk_ag_free() argument
664 xrep_reset_perag_resv(sc); in xchk_ag_free()
666 xfs_trans_brelse(sc->tp, sa->agf_bp); in xchk_ag_free()
670 xfs_trans_brelse(sc->tp, sa->agi_bp); in xchk_ag_free()
688 struct xfs_scrub *sc, in xchk_ag_init() argument
694 error = xchk_ag_read_headers(sc, agno, sa); in xchk_ag_init()
698 xchk_ag_btcur_init(sc, sa); in xchk_ag_init()
712 struct xfs_scrub *sc, in xchk_rtgroup_init() argument
719 sr->rtg = xfs_rtgroup_get(sc->mp, rgno); in xchk_rtgroup_init()
728 struct xfs_scrub *sc, in xchk_rtgroup_lock() argument
749 if (xchk_should_terminate(sc, &error)) in xchk_rtgroup_lock()
759 if (sc->ip && !xfs_is_internal_inode(sc->ip)) in xchk_rtgroup_lock()
786 if (!(sc->flags & XCHK_FSGATES_DRAIN)) in xchk_rtgroup_lock()
798 if (xfs_has_rtrmapbt(sc->mp) && (rtglock_flags & XFS_RTGLOCK_RMAP)) in xchk_rtgroup_lock()
799 sr->rmap_cur = xfs_rtrmapbt_init_cursor(sc->tp, sr->rtg); in xchk_rtgroup_lock()
801 if (xfs_has_rtreflink(sc->mp) && (rtglock_flags & XFS_RTGLOCK_REFCOUNT)) in xchk_rtgroup_lock()
802 sr->refc_cur = xfs_rtrefcountbt_init_cursor(sc->tp, sr->rtg); in xchk_rtgroup_lock()
847 struct xfs_scrub *sc, in xchk_rtgroup_free() argument
863 struct xfs_scrub *sc) in xchk_trans_cancel() argument
865 xfs_trans_cancel(sc->tp); in xchk_trans_cancel()
866 sc->tp = NULL; in xchk_trans_cancel()
871 struct xfs_scrub *sc) in xchk_trans_alloc_empty() argument
873 return xfs_trans_alloc_empty(sc->mp, &sc->tp); in xchk_trans_alloc_empty()
888 struct xfs_scrub *sc, in xchk_trans_alloc() argument
891 if (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) in xchk_trans_alloc()
892 return xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate, in xchk_trans_alloc()
893 resblks, 0, 0, &sc->tp); in xchk_trans_alloc()
895 return xchk_trans_alloc_empty(sc); in xchk_trans_alloc()
901 struct xfs_scrub *sc) in xchk_setup_fs() argument
905 resblks = xrep_calc_ag_resblks(sc); in xchk_setup_fs()
906 return xchk_trans_alloc(sc, resblks); in xchk_setup_fs()
912 struct xfs_scrub *sc) in xchk_setup_rt() argument
914 return xchk_trans_alloc(sc, xrep_calc_rtgroup_resblks(sc)); in xchk_setup_rt()
920 struct xfs_scrub *sc, in xchk_setup_ag_btree() argument
923 struct xfs_mount *mp = sc->mp; in xchk_setup_ag_btree()
938 error = xchk_setup_fs(sc); in xchk_setup_ag_btree()
942 return xchk_ag_init(sc, sc->sm->sm_agno, &sc->sa); in xchk_setup_ag_btree()
962 struct xfs_scrub *sc, in xchk_iget() argument
966 ASSERT(sc->tp != NULL); in xchk_iget()
968 return xfs_iget(sc->mp, sc->tp, inum, XCHK_IGET_FLAGS, 0, ipp); in xchk_iget()
989 struct xfs_scrub *sc, in xchk_iget_agi() argument
994 struct xfs_mount *mp = sc->mp; in xchk_iget_agi()
995 struct xfs_trans *tp = sc->tp; in xchk_iget_agi()
999 ASSERT(sc->tp != NULL); in xchk_iget_agi()
1006 if (xchk_should_terminate(sc, &error)) in xchk_iget_agi()
1059 struct xfs_scrub *sc) in xchk_ino_dqattach() argument
1061 ASSERT(sc->tp != NULL); in xchk_ino_dqattach()
1062 ASSERT(sc->ip != NULL); in xchk_ino_dqattach()
1064 if (!xchk_could_repair(sc)) in xchk_ino_dqattach()
1067 return xrep_ino_dqattach(sc); in xchk_ino_dqattach()
1074 struct xfs_scrub *sc, in xchk_install_handle_inode() argument
1077 if (VFS_I(ip)->i_generation != sc->sm->sm_gen) { in xchk_install_handle_inode()
1078 xchk_irele(sc, ip); in xchk_install_handle_inode()
1082 sc->ip = ip; in xchk_install_handle_inode()
1093 struct xfs_scrub *sc, in xchk_install_live_inode() argument
1097 xchk_ino_set_corrupt(sc, ip->i_ino); in xchk_install_live_inode()
1101 sc->ip = ip; in xchk_install_live_inode()
1114 struct xfs_scrub *sc) in xchk_iget_for_scrubbing() argument
1117 struct xfs_mount *mp = sc->mp; in xchk_iget_for_scrubbing()
1120 struct xfs_inode *ip_in = XFS_I(file_inode(sc->file)); in xchk_iget_for_scrubbing()
1122 xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, sc->sm->sm_ino); in xchk_iget_for_scrubbing()
1125 ASSERT(sc->tp == NULL); in xchk_iget_for_scrubbing()
1128 if (sc->sm->sm_ino == 0 || sc->sm->sm_ino == ip_in->i_ino) in xchk_iget_for_scrubbing()
1129 return xchk_install_live_inode(sc, ip_in); in xchk_iget_for_scrubbing()
1137 if (!xfs_has_metadir(mp) && xfs_is_sb_inum(mp, sc->sm->sm_ino)) in xchk_iget_for_scrubbing()
1140 if (!xfs_verify_ino(sc->mp, sc->sm->sm_ino)) in xchk_iget_for_scrubbing()
1144 error = xchk_iget_safe(sc, sc->sm->sm_ino, &ip); in xchk_iget_for_scrubbing()
1146 return xchk_install_handle_inode(sc, ip); in xchk_iget_for_scrubbing()
1167 error = xchk_trans_alloc(sc, 0); in xchk_iget_for_scrubbing()
1171 error = xchk_iget_agi(sc, sc->sm->sm_ino, &agi_bp, &ip); in xchk_iget_for_scrubbing()
1174 xchk_trans_cancel(sc); in xchk_iget_for_scrubbing()
1175 return xchk_install_handle_inode(sc, ip); in xchk_iget_for_scrubbing()
1205 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, sc->sm->sm_ino)); in xchk_iget_for_scrubbing()
1211 error = xfs_imap(pag, sc->tp, sc->sm->sm_ino, &imap, in xchk_iget_for_scrubbing()
1220 xchk_trans_cancel(sc); in xchk_iget_for_scrubbing()
1222 trace_xchk_op_error(sc, agno, XFS_INO_TO_AGBNO(mp, sc->sm->sm_ino), in xchk_iget_for_scrubbing()
1227 xchk_trans_cancel(sc); in xchk_iget_for_scrubbing()
1234 struct xfs_scrub *sc, in xchk_irele() argument
1237 if (sc->tp) { in xchk_irele()
1265 struct xfs_scrub *sc, in xchk_setup_inode_contents() argument
1270 error = xchk_iget_for_scrubbing(sc); in xchk_setup_inode_contents()
1274 error = xrep_tempfile_adjust_directory_tree(sc); in xchk_setup_inode_contents()
1279 xchk_ilock(sc, XFS_IOLOCK_EXCL); in xchk_setup_inode_contents()
1281 error = xchk_trans_alloc(sc, resblks); in xchk_setup_inode_contents()
1285 error = xchk_ino_dqattach(sc); in xchk_setup_inode_contents()
1289 xchk_ilock(sc, XFS_ILOCK_EXCL); in xchk_setup_inode_contents()
1297 struct xfs_scrub *sc, in xchk_ilock() argument
1300 xfs_ilock(sc->ip, ilock_flags); in xchk_ilock()
1301 sc->ilock_flags |= ilock_flags; in xchk_ilock()
1306 struct xfs_scrub *sc, in xchk_ilock_nowait() argument
1309 if (xfs_ilock_nowait(sc->ip, ilock_flags)) { in xchk_ilock_nowait()
1310 sc->ilock_flags |= ilock_flags; in xchk_ilock_nowait()
1319 struct xfs_scrub *sc, in xchk_iunlock() argument
1322 sc->ilock_flags &= ~ilock_flags; in xchk_iunlock()
1323 xfs_iunlock(sc->ip, ilock_flags); in xchk_iunlock()
1333 struct xfs_scrub *sc, in xchk_should_check_xref() argument
1338 if (xchk_skip_xref(sc->sm)) in xchk_should_check_xref()
1354 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XFAIL; in xchk_should_check_xref()
1355 trace_xchk_xref_error(sc, *error, __return_address); in xchk_should_check_xref()
1368 struct xfs_scrub *sc, in xchk_buffer_recheck() argument
1374 xchk_block_set_corrupt(sc, bp); in xchk_buffer_recheck()
1378 xchk_set_incomplete(sc); in xchk_buffer_recheck()
1384 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; in xchk_buffer_recheck()
1385 trace_xchk_block_error(sc, xfs_buf_daddr(bp), fa); in xchk_buffer_recheck()
1390 struct xfs_scrub *sc, in xchk_metadata_inode_subtype() argument
1396 sub = xchk_scrub_create_subord(sc, scrub_type); in xchk_metadata_inode_subtype()
1397 error = sub->sc.ops->scrub(&sub->sc); in xchk_metadata_inode_subtype()
1404 * pointed to by sc->ip and the ILOCK must be held.
1408 struct xfs_scrub *sc) in xchk_metadata_inode_forks() argument
1413 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) in xchk_metadata_inode_forks()
1417 error = xchk_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_INODE); in xchk_metadata_inode_forks()
1418 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
1422 if (sc->ip->i_diflags & XFS_DIFLAG_REALTIME) { in xchk_metadata_inode_forks()
1423 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1428 if (xfs_is_reflink_inode(sc->ip)) { in xchk_metadata_inode_forks()
1429 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1434 error = xchk_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_BMBTD); in xchk_metadata_inode_forks()
1435 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
1439 if (xfs_has_reflink(sc->mp)) { in xchk_metadata_inode_forks()
1440 error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip, in xchk_metadata_inode_forks()
1442 if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, in xchk_metadata_inode_forks()
1446 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1453 if (xfs_inode_hasattr(sc->ip)) { in xchk_metadata_inode_forks()
1454 if (!xfs_has_metadir(sc->mp)) { in xchk_metadata_inode_forks()
1455 xchk_ino_set_corrupt(sc, sc->ip->i_ino); in xchk_metadata_inode_forks()
1459 error = xchk_metadata_inode_subtype(sc, XFS_SCRUB_TYPE_BMBTA); in xchk_metadata_inode_forks()
1460 if (error || (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) in xchk_metadata_inode_forks()
1475 struct xfs_scrub *sc, in xchk_fsgates_enable() argument
1479 ASSERT(!(sc->flags & scrub_fsgates)); in xchk_fsgates_enable()
1481 trace_xchk_fsgates_enable(sc, scrub_fsgates); in xchk_fsgates_enable()
1495 sc->flags |= scrub_fsgates; in xchk_fsgates_enable()
1516 struct xfs_scrub *sc, in xchk_inode_is_allocated() argument
1520 struct xfs_mount *mp = sc->mp; in xchk_inode_is_allocated()
1521 struct xfs_perag *pag = sc->sa.pag; in xchk_inode_is_allocated()
1533 if (sc->sa.agi_bp == NULL) { in xchk_inode_is_allocated()
1534 ASSERT(sc->sa.agi_bp != NULL); in xchk_inode_is_allocated()
1681 struct xfs_scrub *sc, in xchk_meta_btree_count_blocks() argument
1688 if (!sc->sr.rtg) { in xchk_meta_btree_count_blocks()
1693 switch (sc->ip->i_metatype) { in xchk_meta_btree_count_blocks()
1695 cur = xfs_rtrmapbt_init_cursor(sc->tp, sc->sr.rtg); in xchk_meta_btree_count_blocks()
1698 cur = xfs_rtrefcountbt_init_cursor(sc->tp, sc->sr.rtg); in xchk_meta_btree_count_blocks()
1717 struct xfs_scrub *sc, in xchk_inode_count_blocks() argument
1722 struct xfs_ifork *ifp = xfs_ifork_ptr(sc->ip, whichfork); in xchk_inode_count_blocks()
1732 return xchk_meta_btree_count_blocks(sc, nextents, count); in xchk_inode_count_blocks()
1735 return xfs_bmap_count_blocks(sc->tp, sc->ip, whichfork, nextents, in xchk_inode_count_blocks()