Lines Matching refs:xnc

50 	struct xchk_nlink_ctrs	*xnc;  in xchk_setup_nlinks()  local
61 xnc = kvzalloc(sizeof(struct xchk_nlink_ctrs), XCHK_GFP_FLAGS); in xchk_setup_nlinks()
62 if (!xnc) in xchk_setup_nlinks()
64 xnc->xname.name = xnc->namebuf; in xchk_setup_nlinks()
65 xnc->sc = sc; in xchk_setup_nlinks()
66 sc->buf = xnc; in xchk_setup_nlinks()
119 struct xchk_nlink_ctrs *xnc, in xchk_nlinks_update_incore() argument
128 if (!xnc->nlinks) in xchk_nlinks_update_incore()
131 error = xfarray_load_sparse(xnc->nlinks, ino, &nl); in xchk_nlinks_update_incore()
135 trace_xchk_nlinks_update_incore(xnc->sc->mp, ino, &nl, parents_delta, in xchk_nlinks_update_incore()
143 error = xfarray_store(xnc->nlinks, ino, &nl); in xchk_nlinks_update_incore()
166 struct xchk_nlink_ctrs *xnc; in xchk_nlinks_live_update() local
169 xnc = container_of(nb, struct xchk_nlink_ctrs, dhook.dirent_hook.nb); in xchk_nlinks_live_update()
178 trace_xchk_nlinks_live_update(xnc->sc->mp, p->dp, action, p->ip->i_ino, in xchk_nlinks_live_update()
186 if (xchk_iscan_want_live_update(&xnc->collect_iscan, p->dp->i_ino)) { in xchk_nlinks_live_update()
187 mutex_lock(&xnc->lock); in xchk_nlinks_live_update()
188 error = xchk_nlinks_update_incore(xnc, p->ip->i_ino, p->delta, in xchk_nlinks_live_update()
191 error = xchk_nlinks_update_incore(xnc, p->dp->i_ino, 0, in xchk_nlinks_live_update()
193 mutex_unlock(&xnc->lock); in xchk_nlinks_live_update()
203 xchk_iscan_want_live_update(&xnc->collect_iscan, p->ip->i_ino)) { in xchk_nlinks_live_update()
204 mutex_lock(&xnc->lock); in xchk_nlinks_live_update()
205 error = xchk_nlinks_update_incore(xnc, p->dp->i_ino, 0, in xchk_nlinks_live_update()
207 mutex_unlock(&xnc->lock); in xchk_nlinks_live_update()
215 xchk_iscan_abort(&xnc->collect_iscan); in xchk_nlinks_live_update()
229 struct xchk_nlink_ctrs *xnc = priv; in xchk_nlinks_collect_dirent() local
259 if (xchk_iscan_aborted(&xnc->collect_iscan)) { in xchk_nlinks_collect_dirent()
266 mutex_lock(&xnc->lock); in xchk_nlinks_collect_dirent()
283 error = xchk_nlinks_update_incore(xnc, ino, 1, 0, 0); in xchk_nlinks_collect_dirent()
285 error = xchk_nlinks_update_incore(xnc, ino, 0, 1, 0); in xchk_nlinks_collect_dirent()
297 error = xchk_nlinks_update_incore(xnc, ino, 1, 0, 0); in xchk_nlinks_collect_dirent()
307 error = xchk_nlinks_update_incore(xnc, dp->i_ino, 0, 0, 1); in xchk_nlinks_collect_dirent()
312 mutex_unlock(&xnc->lock); in xchk_nlinks_collect_dirent()
316 mutex_unlock(&xnc->lock); in xchk_nlinks_collect_dirent()
318 xchk_iscan_abort(&xnc->collect_iscan); in xchk_nlinks_collect_dirent()
340 struct xchk_nlink_ctrs *xnc = priv; in xchk_nlinks_collect_pptr() local
347 if (xchk_iscan_aborted(&xnc->collect_iscan)) { in xchk_nlinks_collect_pptr()
362 mutex_lock(&xnc->lock); in xchk_nlinks_collect_pptr()
364 error = xchk_nlinks_update_incore(xnc, parent_ino, 0, 1, 0); in xchk_nlinks_collect_pptr()
368 mutex_unlock(&xnc->lock); in xchk_nlinks_collect_pptr()
372 mutex_unlock(&xnc->lock); in xchk_nlinks_collect_pptr()
373 xchk_iscan_abort(&xnc->collect_iscan); in xchk_nlinks_collect_pptr()
382 struct xchk_nlink_ctrs *xnc, in xchk_nlinks_collect_dir() argument
385 struct xfs_scrub *sc = xnc->sc; in xchk_nlinks_collect_dir()
417 error = xchk_dir_walk(sc, dp, xchk_nlinks_collect_dirent, xnc); in xchk_nlinks_collect_dir()
438 xnc); in xchk_nlinks_collect_dir()
447 xchk_iscan_mark_visited(&xnc->collect_iscan, dp); in xchk_nlinks_collect_dir()
452 xchk_iscan_abort(&xnc->collect_iscan); in xchk_nlinks_collect_dir()
462 struct xchk_nlink_ctrs *xnc, in xchk_nlinks_collect_metafile() argument
465 if (!xfs_verify_ino(xnc->sc->mp, ino)) in xchk_nlinks_collect_metafile()
468 trace_xchk_nlinks_collect_metafile(xnc->sc->mp, ino); in xchk_nlinks_collect_metafile()
469 return xchk_nlinks_update_incore(xnc, ino, 1, 0, 0); in xchk_nlinks_collect_metafile()
475 struct xchk_nlink_ctrs *xnc) in xchk_nlinks_collect_metafiles() argument
477 struct xfs_mount *mp = xnc->sc->mp; in xchk_nlinks_collect_metafiles()
481 if (xchk_iscan_aborted(&xnc->collect_iscan)) in xchk_nlinks_collect_metafiles()
484 mutex_lock(&xnc->lock); in xchk_nlinks_collect_metafiles()
485 error = xchk_nlinks_collect_metafile(xnc, mp->m_sb.sb_rbmino); in xchk_nlinks_collect_metafiles()
489 error = xchk_nlinks_collect_metafile(xnc, mp->m_sb.sb_rsumino); in xchk_nlinks_collect_metafiles()
493 error = xchk_nlinks_collect_metafile(xnc, mp->m_sb.sb_uquotino); in xchk_nlinks_collect_metafiles()
497 error = xchk_nlinks_collect_metafile(xnc, mp->m_sb.sb_gquotino); in xchk_nlinks_collect_metafiles()
501 error = xchk_nlinks_collect_metafile(xnc, mp->m_sb.sb_pquotino); in xchk_nlinks_collect_metafiles()
504 mutex_unlock(&xnc->lock); in xchk_nlinks_collect_metafiles()
509 mutex_unlock(&xnc->lock); in xchk_nlinks_collect_metafiles()
510 xchk_iscan_abort(&xnc->collect_iscan); in xchk_nlinks_collect_metafiles()
512 xchk_set_incomplete(xnc->sc); in xchk_nlinks_collect_metafiles()
519 struct xchk_nlink_ctrs *xnc, in xchk_nlinks_collect_file() argument
523 xchk_iscan_mark_visited(&xnc->collect_iscan, ip); in xchk_nlinks_collect_file()
531 struct xchk_nlink_ctrs *xnc) in xchk_nlinks_collect() argument
533 struct xfs_scrub *sc = xnc->sc; in xchk_nlinks_collect()
538 error = xchk_nlinks_collect_metafiles(xnc); in xchk_nlinks_collect()
562 while ((error = xchk_iscan_iter(&xnc->collect_iscan, &ip)) == 1) { in xchk_nlinks_collect()
564 error = xchk_nlinks_collect_dir(xnc, ip); in xchk_nlinks_collect()
566 error = xchk_nlinks_collect_file(xnc, ip); in xchk_nlinks_collect()
574 xchk_iscan_iter_finish(&xnc->collect_iscan); in xchk_nlinks_collect()
605 struct xchk_nlink_ctrs *xnc, in xchk_nlinks_comparison_read() argument
612 error = xfarray_load_sparse(xnc->nlinks, ino, &nl); in xchk_nlinks_comparison_read()
618 error = xfarray_store(xnc->nlinks, ino, &nl); in xchk_nlinks_comparison_read()
626 xchk_set_incomplete(xnc->sc); in xchk_nlinks_comparison_read()
643 struct xchk_nlink_ctrs *xnc, in xchk_nlinks_compare_inode() argument
647 struct xfs_scrub *sc = xnc->sc; in xchk_nlinks_compare_inode()
661 mutex_lock(&xnc->lock); in xchk_nlinks_compare_inode()
663 if (xchk_iscan_aborted(&xnc->collect_iscan)) { in xchk_nlinks_compare_inode()
664 xchk_set_incomplete(xnc->sc); in xchk_nlinks_compare_inode()
669 error = xchk_nlinks_comparison_read(xnc, ip->i_ino, &obs); in xchk_nlinks_compare_inode()
764 mutex_unlock(&xnc->lock); in xchk_nlinks_compare_inode()
776 struct xchk_nlink_ctrs *xnc, in xchk_nlinks_compare_inum() argument
780 struct xfs_mount *mp = xnc->sc->mp; in xchk_nlinks_compare_inum()
781 struct xfs_trans *tp = xnc->sc->tp; in xchk_nlinks_compare_inum()
793 error = xchk_iget_agi(xnc->sc, ino, &agi_bp, &ip); in xchk_nlinks_compare_inum()
796 error = xchk_nlinks_compare_inode(xnc, ip); in xchk_nlinks_compare_inum()
797 xchk_irele(xnc->sc, ip); in xchk_nlinks_compare_inum()
810 xchk_set_incomplete(xnc->sc); in xchk_nlinks_compare_inum()
814 if (xchk_iscan_aborted(&xnc->collect_iscan)) { in xchk_nlinks_compare_inum()
815 xchk_set_incomplete(xnc->sc); in xchk_nlinks_compare_inum()
820 mutex_lock(&xnc->lock); in xchk_nlinks_compare_inum()
821 error = xchk_nlinks_comparison_read(xnc, ino, &obs); in xchk_nlinks_compare_inum()
832 xchk_ino_set_corrupt(xnc->sc, ino); in xchk_nlinks_compare_inum()
837 mutex_unlock(&xnc->lock); in xchk_nlinks_compare_inum()
851 struct xchk_nlink_ctrs *xnc, in xchk_nlinks_compare_iter() argument
857 error = xchk_iscan_iter(&xnc->compare_iscan, ipp); in xchk_nlinks_compare_iter()
866 struct xchk_nlink_ctrs *xnc) in xchk_nlinks_compare() argument
869 struct xfs_scrub *sc = xnc->sc; in xchk_nlinks_compare()
892 xchk_iscan_start(sc, 0, 0, &xnc->compare_iscan); in xchk_nlinks_compare()
893 while ((error = xchk_nlinks_compare_iter(xnc, &ip)) == 1) { in xchk_nlinks_compare()
894 error = xchk_nlinks_compare_inode(xnc, ip); in xchk_nlinks_compare()
895 xchk_iscan_mark_visited(&xnc->compare_iscan, ip); in xchk_nlinks_compare()
903 xchk_iscan_iter_finish(&xnc->compare_iscan); in xchk_nlinks_compare()
904 xchk_iscan_teardown(&xnc->compare_iscan); in xchk_nlinks_compare()
915 mutex_lock(&xnc->lock); in xchk_nlinks_compare()
916 while ((error = xfarray_iter(xnc->nlinks, &cur, &nl)) == 1) { in xchk_nlinks_compare()
922 mutex_unlock(&xnc->lock); in xchk_nlinks_compare()
924 error = xchk_nlinks_compare_inum(xnc, ino); in xchk_nlinks_compare()
928 if (xchk_should_terminate(xnc->sc, &error)) in xchk_nlinks_compare()
931 mutex_lock(&xnc->lock); in xchk_nlinks_compare()
933 mutex_unlock(&xnc->lock); in xchk_nlinks_compare()
943 struct xchk_nlink_ctrs *xnc = priv; in xchk_nlinks_teardown_scan() local
946 xchk_iscan_abort(&xnc->collect_iscan); in xchk_nlinks_teardown_scan()
948 xfs_dir_hook_del(xnc->sc->mp, &xnc->dhook); in xchk_nlinks_teardown_scan()
950 xfarray_destroy(xnc->nlinks); in xchk_nlinks_teardown_scan()
951 xnc->nlinks = NULL; in xchk_nlinks_teardown_scan()
953 xchk_iscan_teardown(&xnc->collect_iscan); in xchk_nlinks_teardown_scan()
954 mutex_destroy(&xnc->lock); in xchk_nlinks_teardown_scan()
955 xnc->sc = NULL; in xchk_nlinks_teardown_scan()
966 struct xchk_nlink_ctrs *xnc) in xchk_nlinks_setup_scan() argument
975 mutex_init(&xnc->lock); in xchk_nlinks_setup_scan()
978 xchk_iscan_start(sc, 30000, 100, &xnc->collect_iscan); in xchk_nlinks_setup_scan()
988 sizeof(struct xchk_nlink), &xnc->nlinks); in xchk_nlinks_setup_scan()
1001 xfs_dir_hook_setup(&xnc->dhook, xchk_nlinks_live_update); in xchk_nlinks_setup_scan()
1002 error = xfs_dir_hook_add(mp, &xnc->dhook); in xchk_nlinks_setup_scan()
1011 xchk_nlinks_teardown_scan(xnc); in xchk_nlinks_setup_scan()
1020 struct xchk_nlink_ctrs *xnc = sc->buf; in xchk_nlinks() local
1024 error = xchk_nlinks_setup_scan(sc, xnc); in xchk_nlinks()
1029 error = xchk_nlinks_collect(xnc); in xchk_nlinks()
1034 if (xchk_iscan_aborted(&xnc->collect_iscan)) in xchk_nlinks()
1040 error = xchk_nlinks_compare(xnc); in xchk_nlinks()
1045 if (xchk_iscan_aborted(&xnc->collect_iscan)) in xchk_nlinks()