Lines Matching refs:iscan
60 struct xchk_iscan *iscan, in xchk_iscan_mask_skipino() argument
65 struct xfs_scrub *sc = iscan->sc; in xchk_iscan_mask_skipino()
67 xfs_agnumber_t skip_agno = XFS_INO_TO_AGNO(mp, iscan->skip_ino); in xchk_iscan_mask_skipino()
68 xfs_agnumber_t skip_agino = XFS_INO_TO_AGINO(mp, iscan->skip_ino); in xchk_iscan_mask_skipino()
86 struct xchk_iscan *iscan, in xchk_iscan_find_next() argument
93 struct xfs_scrub *sc = iscan->sc; in xchk_iscan_find_next()
156 if (iscan->skip_ino) in xchk_iscan_find_next()
157 xchk_iscan_mask_skipino(iscan, pag, &rec, lastino); in xchk_iscan_find_next()
200 struct xchk_iscan *iscan, in xchk_iscan_move_cursor() argument
204 struct xfs_scrub *sc = iscan->sc; in xchk_iscan_move_cursor()
221 mutex_lock(&iscan->lock); in xchk_iscan_move_cursor()
222 iscan->cursor_ino = cursor; in xchk_iscan_move_cursor()
223 iscan->__visited_ino = visited; in xchk_iscan_move_cursor()
224 trace_xchk_iscan_move_cursor(iscan); in xchk_iscan_move_cursor()
225 mutex_unlock(&iscan->lock); in xchk_iscan_move_cursor()
235 struct xchk_iscan *iscan) in xchk_iscan_finish() argument
237 mutex_lock(&iscan->lock); in xchk_iscan_finish()
238 iscan->cursor_ino = NULLFSINO; in xchk_iscan_finish()
241 iscan->__visited_ino = NULLFSINO; in xchk_iscan_finish()
243 mutex_unlock(&iscan->lock); in xchk_iscan_finish()
249 struct xchk_iscan *iscan) in xchk_iscan_finish_early() argument
251 ASSERT(iscan->cursor_ino == iscan->scan_start_ino); in xchk_iscan_finish_early()
252 ASSERT(iscan->__visited_ino == iscan->scan_start_ino); in xchk_iscan_finish_early()
254 xchk_iscan_finish(iscan); in xchk_iscan_finish_early()
264 struct xchk_iscan *iscan, in xchk_iscan_read_agi() argument
268 struct xfs_scrub *sc = iscan->sc; in xchk_iscan_read_agi()
272 if (!xchk_iscan_agi_needs_trylock(iscan)) in xchk_iscan_read_agi()
275 relax = msecs_to_jiffies(iscan->iget_retry_delay); in xchk_iscan_read_agi()
281 if (!iscan->iget_timeout || in xchk_iscan_read_agi()
282 time_is_before_jiffies(iscan->__iget_deadline)) in xchk_iscan_read_agi()
285 trace_xchk_iscan_agi_retry_wait(iscan); in xchk_iscan_read_agi()
287 !xchk_iscan_aborted(iscan)); in xchk_iscan_read_agi()
304 struct xchk_iscan *iscan, in xchk_iscan_advance() argument
310 struct xfs_scrub *sc = iscan->sc; in xchk_iscan_advance()
318 ASSERT(iscan->cursor_ino >= iscan->__visited_ino); in xchk_iscan_advance()
321 if (xchk_iscan_aborted(iscan)) in xchk_iscan_advance()
324 agno = XFS_INO_TO_AGNO(mp, iscan->cursor_ino); in xchk_iscan_advance()
329 ret = xchk_iscan_read_agi(iscan, pag, &agi_bp); in xchk_iscan_advance()
333 agino = XFS_INO_TO_AGINO(mp, iscan->cursor_ino); in xchk_iscan_advance()
334 ret = xchk_iscan_find_next(iscan, agi_bp, pag, allocmaskp, in xchk_iscan_advance()
345 xchk_iscan_move_cursor(iscan, agno, agino); in xchk_iscan_advance()
356 xchk_iscan_move_cursor(iscan, agno, 0); in xchk_iscan_advance()
360 trace_xchk_iscan_advance_ag(iscan); in xchk_iscan_advance()
361 } while (iscan->cursor_ino != iscan->scan_start_ino); in xchk_iscan_advance()
363 xchk_iscan_finish(iscan); in xchk_iscan_advance()
381 struct xchk_iscan *iscan, in xchk_iscan_iget_retry() argument
384 ASSERT(iscan->cursor_ino == iscan->__visited_ino + 1); in xchk_iscan_iget_retry()
386 if (!iscan->iget_timeout || in xchk_iscan_iget_retry()
387 time_is_before_jiffies(iscan->__iget_deadline)) in xchk_iscan_iget_retry()
398 relax = msecs_to_jiffies(iscan->iget_retry_delay); in xchk_iscan_iget_retry()
399 trace_xchk_iscan_iget_retry_wait(iscan); in xchk_iscan_iget_retry()
402 xchk_iscan_aborted(iscan)) in xchk_iscan_iget_retry()
406 iscan->cursor_ino--; in xchk_iscan_iget_retry()
430 struct xchk_iscan *iscan, in xchk_iscan_iget() argument
436 struct xfs_scrub *sc = iscan->sc; in xchk_iscan_iget()
438 xfs_ino_t ino = iscan->cursor_ino; in xchk_iscan_iget()
443 ASSERT(iscan->__inodes[0] == NULL); in xchk_iscan_iget()
447 &iscan->__inodes[idx]); in xchk_iscan_iget()
449 trace_xchk_iscan_iget(iscan, error); in xchk_iscan_iget()
466 return xchk_iscan_iget_retry(iscan, true); in xchk_iscan_iget()
480 return xchk_iscan_iget_retry(iscan, false); in xchk_iscan_iget()
501 mutex_lock(&iscan->lock); in xchk_iscan_iget()
502 iscan->__batch_ino = ino - 1; in xchk_iscan_iget()
503 iscan->__skipped_inomask = 0; in xchk_iscan_iget()
504 mutex_unlock(&iscan->lock); in xchk_iscan_iget()
508 ASSERT(!(iscan->__skipped_inomask & (1ULL << i))); in xchk_iscan_iget()
510 mutex_lock(&iscan->lock); in xchk_iscan_iget()
511 iscan->cursor_ino = ino; in xchk_iscan_iget()
512 iscan->__skipped_inomask |= (1ULL << i); in xchk_iscan_iget()
513 mutex_unlock(&iscan->lock); in xchk_iscan_iget()
517 ASSERT(iscan->__inodes[idx] == NULL); in xchk_iscan_iget()
520 &iscan->__inodes[idx]); in xchk_iscan_iget()
524 mutex_lock(&iscan->lock); in xchk_iscan_iget()
525 iscan->cursor_ino = ino; in xchk_iscan_iget()
526 mutex_unlock(&iscan->lock); in xchk_iscan_iget()
530 trace_xchk_iscan_iget_batch(sc->mp, iscan, nr_inodes, idx); in xchk_iscan_iget()
542 struct xchk_iscan *iscan) in xchk_iscan_finish_batch() argument
546 mutex_lock(&iscan->lock); in xchk_iscan_finish_batch()
548 if (iscan->__batch_ino != NULLFSINO) { in xchk_iscan_finish_batch()
549 highest_skipped = iscan->__batch_ino + in xchk_iscan_finish_batch()
550 xfs_highbit64(iscan->__skipped_inomask); in xchk_iscan_finish_batch()
551 iscan->__visited_ino = max(iscan->__visited_ino, in xchk_iscan_finish_batch()
554 trace_xchk_iscan_skip(iscan); in xchk_iscan_finish_batch()
557 iscan->__batch_ino = NULLFSINO; in xchk_iscan_finish_batch()
558 iscan->__skipped_inomask = 0; in xchk_iscan_finish_batch()
560 mutex_unlock(&iscan->lock); in xchk_iscan_finish_batch()
569 struct xchk_iscan *iscan) in xchk_iscan_iter_batch() argument
571 struct xfs_scrub *sc = iscan->sc; in xchk_iscan_iter_batch()
574 xchk_iscan_finish_batch(iscan); in xchk_iscan_iter_batch()
576 if (iscan->iget_timeout) in xchk_iscan_iter_batch()
577 iscan->__iget_deadline = jiffies + in xchk_iscan_iter_batch()
578 msecs_to_jiffies(iscan->iget_timeout); in xchk_iscan_iter_batch()
586 ret = xchk_iscan_advance(iscan, &pag, &agi_bp, &allocmask, in xchk_iscan_iter_batch()
591 if (xchk_iscan_aborted(iscan)) { in xchk_iscan_iter_batch()
598 ret = xchk_iscan_iget(iscan, pag, agi_bp, allocmask, nr_inodes); in xchk_iscan_iter_batch()
618 struct xchk_iscan *iscan, in xchk_iscan_iter() argument
626 if (iscan->__inodes[i]) in xchk_iscan_iter()
630 error = xchk_iscan_iter_batch(iscan); in xchk_iscan_iter()
634 ASSERT(iscan->__inodes[0] != NULL); in xchk_iscan_iter()
639 *ipp = iscan->__inodes[i]; in xchk_iscan_iter()
640 iscan->__inodes[i] = NULL; in xchk_iscan_iter()
647 struct xchk_iscan *iscan) in xchk_iscan_iter_finish() argument
649 struct xfs_scrub *sc = iscan->sc; in xchk_iscan_iter_finish()
653 if (iscan->__inodes[i]) { in xchk_iscan_iter_finish()
654 xchk_irele(sc, iscan->__inodes[i]); in xchk_iscan_iter_finish()
655 iscan->__inodes[i] = NULL; in xchk_iscan_iter_finish()
663 struct xchk_iscan *iscan) in xchk_iscan_teardown() argument
665 xchk_iscan_iter_finish(iscan); in xchk_iscan_teardown()
666 xchk_iscan_finish(iscan); in xchk_iscan_teardown()
667 mutex_destroy(&iscan->lock); in xchk_iscan_teardown()
699 struct xchk_iscan *iscan) in xchk_iscan_start() argument
705 iscan->__batch_ino = NULLFSINO; in xchk_iscan_start()
706 iscan->__skipped_inomask = 0; in xchk_iscan_start()
708 iscan->sc = sc; in xchk_iscan_start()
709 clear_bit(XCHK_ISCAN_OPSTATE_ABORTED, &iscan->__opstate); in xchk_iscan_start()
710 iscan->iget_timeout = iget_timeout; in xchk_iscan_start()
711 iscan->iget_retry_delay = iget_retry_delay; in xchk_iscan_start()
712 iscan->__visited_ino = start_ino; in xchk_iscan_start()
713 iscan->cursor_ino = start_ino; in xchk_iscan_start()
714 iscan->scan_start_ino = start_ino; in xchk_iscan_start()
715 mutex_init(&iscan->lock); in xchk_iscan_start()
716 memset(iscan->__inodes, 0, sizeof(iscan->__inodes)); in xchk_iscan_start()
718 trace_xchk_iscan_start(iscan, start_ino); in xchk_iscan_start()
727 struct xchk_iscan *iscan, in xchk_iscan_mark_visited() argument
730 mutex_lock(&iscan->lock); in xchk_iscan_mark_visited()
731 iscan->__visited_ino = ip->i_ino; in xchk_iscan_mark_visited()
732 trace_xchk_iscan_visit(iscan); in xchk_iscan_mark_visited()
733 mutex_unlock(&iscan->lock); in xchk_iscan_mark_visited()
743 const struct xchk_iscan *iscan, in xchk_iscan_skipped() argument
746 if (iscan->__batch_ino == NULLFSINO) in xchk_iscan_skipped()
748 if (ino < iscan->__batch_ino) in xchk_iscan_skipped()
750 if (ino >= iscan->__batch_ino + XFS_INODES_PER_CHUNK) in xchk_iscan_skipped()
753 return iscan->__skipped_inomask & (1ULL << (ino - iscan->__batch_ino)); in xchk_iscan_skipped()
764 struct xchk_iscan *iscan, in xchk_iscan_want_live_update() argument
769 if (xchk_iscan_aborted(iscan)) in xchk_iscan_want_live_update()
772 mutex_lock(&iscan->lock); in xchk_iscan_want_live_update()
774 trace_xchk_iscan_want_live_update(iscan, ino); in xchk_iscan_want_live_update()
777 if (iscan->__visited_ino == NULLFSINO) { in xchk_iscan_want_live_update()
786 if (iscan->scan_start_ino == iscan->__visited_ino) { in xchk_iscan_want_live_update()
795 if (xchk_iscan_skipped(iscan, ino)) { in xchk_iscan_want_live_update()
806 if (iscan->scan_start_ino <= iscan->__visited_ino) { in xchk_iscan_want_live_update()
807 if (ino >= iscan->scan_start_ino && in xchk_iscan_want_live_update()
808 ino <= iscan->__visited_ino) in xchk_iscan_want_live_update()
820 if (ino >= iscan->scan_start_ino || ino <= iscan->__visited_ino) in xchk_iscan_want_live_update()
824 mutex_unlock(&iscan->lock); in xchk_iscan_want_live_update()