Lines Matching full:rr
105 struct xrep_rtrmap *rr; in xrep_setup_rtrmapbt() local
117 rr = kzalloc(sizeof(struct xrep_rtrmap), XCHK_GFP_FLAGS); in xrep_setup_rtrmapbt()
118 if (!rr) in xrep_setup_rtrmapbt()
121 rr->sc = sc; in xrep_setup_rtrmapbt()
122 sc->buf = rr; in xrep_setup_rtrmapbt()
143 struct xrep_rtrmap *rr, in xrep_rtrmap_stash() argument
157 struct xfs_scrub *sc = rr->sc; in xrep_rtrmap_stash()
164 if (xchk_iscan_aborted(&rr->iscan)) in xrep_rtrmap_stash()
170 mutex_lock(&rr->lock); in xrep_rtrmap_stash()
171 mcur = xfs_rtrmapbt_mem_cursor(sc->sr.rtg, sc->tp, &rr->rtrmap_btree); in xrep_rtrmap_stash()
177 error = xfbtree_trans_commit(&rr->rtrmap_btree, sc->tp); in xrep_rtrmap_stash()
181 mutex_unlock(&rr->lock); in xrep_rtrmap_stash()
185 xfbtree_trans_cancel(&rr->rtrmap_btree, sc->tp); in xrep_rtrmap_stash()
187 xchk_iscan_abort(&rr->iscan); in xrep_rtrmap_stash()
188 mutex_unlock(&rr->lock); in xrep_rtrmap_stash()
202 struct xrep_rtrmap *rr; member
213 return xrep_rtrmap_stash(rf->rr, rf->accum.rm_startblock, in xrep_rtrmap_stash_accumulated()
227 struct xfs_mount *mp = rf->rr->sc->mp; in xrep_rtrmap_visit_bmbt()
233 rtg_rgno(rf->rr->sc->sr.rtg)) in xrep_rtrmap_visit_bmbt()
272 struct xrep_rtrmap *rr = rf->rr; in xrep_rtrmap_scan_bmbt() local
288 cur = xfs_bmbt_init_cursor(rr->sc->mp, rr->sc->tp, ip, XFS_DATA_FORK); in xrep_rtrmap_scan_bmbt()
326 struct xrep_rtrmap *rr, in xrep_rtrmap_scan_dfork() argument
331 .rr = rr, in xrep_rtrmap_scan_dfork()
359 struct xrep_rtrmap *rr, in xrep_rtrmap_scan_inode() argument
366 if (rr->sc->ip == ip) in xrep_rtrmap_scan_inode()
373 error = xrep_rtrmap_scan_dfork(rr, ip); in xrep_rtrmap_scan_inode()
378 xchk_iscan_mark_visited(&rr->iscan, ip); in xrep_rtrmap_scan_inode()
391 struct xrep_rtrmap *rr = priv; in xrep_rtrmap_walk_rmap() local
394 if (xchk_should_terminate(rr->sc, &error)) in xrep_rtrmap_walk_rmap()
398 if (rec->rm_owner != rr->sc->ip->i_ino) in xrep_rtrmap_walk_rmap()
401 error = xrep_check_ino_btree_mapping(rr->sc, rec); in xrep_rtrmap_walk_rmap()
405 return xfsb_bitmap_set(&rr->old_rtrmapbt_blocks, in xrep_rtrmap_walk_rmap()
413 struct xrep_rtrmap *rr, in xrep_rtrmap_scan_ag() argument
416 struct xfs_scrub *sc = rr->sc; in xrep_rtrmap_scan_ag()
423 error = xfs_rmap_query_all(sc->sa.rmap_cur, xrep_rtrmap_walk_rmap, rr); in xrep_rtrmap_scan_ag()
429 struct xrep_rtrmap *rr; member
440 struct xrep_rtrmap *rr = rsr->rr; in xrep_rtrmap_stash_run() local
443 return xrep_rtrmap_stash(rr, rgbno, len, rsr->owner, 0, 0); in xrep_rtrmap_stash_run()
452 struct xrep_rtrmap *rr, in xrep_rtrmap_stash_bitmap() argument
457 .rr = rr, in xrep_rtrmap_stash_bitmap()
487 struct xrep_rtrmap *rr) in xrep_rtrmap_find_refcount_rmaps() argument
498 struct xfs_scrub *sc = rr->sc; in xrep_rtrmap_find_refcount_rmaps()
513 error = xrep_rtrmap_stash_bitmap(rr, &cow_blocks, &XFS_RMAP_OINFO_COW); in xrep_rtrmap_find_refcount_rmaps()
529 struct xrep_rtrmap *rr = priv; in xrep_rtrmap_check_record() local
532 error = xrep_rtrmap_check_mapping(rr->sc, rec); in xrep_rtrmap_check_record()
536 rr->nr_records++; in xrep_rtrmap_check_record()
543 struct xrep_rtrmap *rr) in xrep_rtrmap_find_rmaps() argument
545 struct xfs_scrub *sc = rr->sc; in xrep_rtrmap_find_rmaps()
552 if (xfs_has_rtsb(sc->mp) && rtg_rgno(rr->sc->sr.rtg) == 0) { in xrep_rtrmap_find_rmaps()
553 error = xrep_rtrmap_stash(rr, 0, sc->mp->m_sb.sb_rextsize, in xrep_rtrmap_find_rmaps()
561 error = xrep_rtrmap_find_refcount_rmaps(rr); in xrep_rtrmap_find_rmaps()
587 while ((error = xchk_iscan_iter(&rr->iscan, &ip)) == 1) { in xrep_rtrmap_find_rmaps()
588 error = xrep_rtrmap_scan_inode(rr, ip); in xrep_rtrmap_find_rmaps()
596 xchk_iscan_iter_finish(&rr->iscan); in xrep_rtrmap_find_rmaps()
616 if (xchk_iscan_aborted(&rr->iscan)) in xrep_rtrmap_find_rmaps()
621 error = xrep_rtrmap_scan_ag(rr, pag); in xrep_rtrmap_find_rmaps()
635 mcur = xfs_rtrmapbt_mem_cursor(rr->sc->sr.rtg, NULL, &rr->rtrmap_btree); in xrep_rtrmap_find_rmaps()
636 rr->nr_records = 0; in xrep_rtrmap_find_rmaps()
637 error = xfs_rmap_query_all(mcur, xrep_rtrmap_check_record, rr); in xrep_rtrmap_find_rmaps()
654 struct xrep_rtrmap *rr = priv; in xrep_rtrmap_get_records() local
662 error = xfs_btree_increment(rr->mcur, 0, &stat); in xrep_rtrmap_get_records()
668 error = xfs_rmap_get_rec(rr->mcur, &cur->bc_rec.r, &stat); in xrep_rtrmap_get_records()
688 struct xrep_rtrmap *rr = priv; in xrep_rtrmap_claim_block() local
690 return xrep_newbt_claim_block(cur, &rr->new_btree, ptr); in xrep_rtrmap_claim_block()
712 struct xrep_rtrmap *rr) in xrep_rtrmap_build_new_tree() argument
714 struct xfs_scrub *sc = rr->sc; in xrep_rtrmap_build_new_tree()
725 error = xrep_newbt_init_metadir_inode(&rr->new_btree, sc); in xrep_rtrmap_build_new_tree()
729 rr->new_btree.bload.get_records = xrep_rtrmap_get_records; in xrep_rtrmap_build_new_tree()
730 rr->new_btree.bload.claim_block = xrep_rtrmap_claim_block; in xrep_rtrmap_build_new_tree()
731 rr->new_btree.bload.iroot_size = xrep_rtrmap_iroot_size; in xrep_rtrmap_build_new_tree()
734 xfs_btree_stage_ifakeroot(rmap_cur, &rr->new_btree.ifake); in xrep_rtrmap_build_new_tree()
738 &rr->new_btree.bload, rr->nr_records); in xrep_rtrmap_build_new_tree()
754 rr->new_btree.bload.nr_blocks, 0, true); in xrep_rtrmap_build_new_tree()
759 error = xrep_newbt_alloc_blocks(&rr->new_btree, in xrep_rtrmap_build_new_tree()
760 rr->new_btree.bload.nr_blocks); in xrep_rtrmap_build_new_tree()
768 rr->mcur = xfs_rtrmapbt_mem_cursor(sc->sr.rtg, NULL, &rr->rtrmap_btree); in xrep_rtrmap_build_new_tree()
769 error = xfs_btree_goto_left_edge(rr->mcur); in xrep_rtrmap_build_new_tree()
774 rr->new_btree.ifake.if_fork->if_format = XFS_DINODE_FMT_META_BTREE; in xrep_rtrmap_build_new_tree()
775 error = xfs_btree_bload(rmap_cur, &rr->new_btree.bload, rr); in xrep_rtrmap_build_new_tree()
785 xrep_inode_set_nblocks(rr->sc, rr->new_btree.ifake.if_blocks); in xrep_rtrmap_build_new_tree()
787 xfs_btree_del_cursor(rr->mcur, 0); in xrep_rtrmap_build_new_tree()
788 rr->mcur = NULL; in xrep_rtrmap_build_new_tree()
794 xchk_iscan_abort(&rr->iscan); in xrep_rtrmap_build_new_tree()
797 error = xrep_newbt_commit(&rr->new_btree); in xrep_rtrmap_build_new_tree()
804 xfs_btree_del_cursor(rr->mcur, error); in xrep_rtrmap_build_new_tree()
807 xrep_newbt_cancel(&rr->new_btree); in xrep_rtrmap_build_new_tree()
816 struct xrep_rtrmap *rr) in xrep_rtrmap_remove_old_tree() argument
824 error = xrep_reap_metadir_fsblocks(rr->sc, &rr->old_rtrmapbt_blocks); in xrep_rtrmap_remove_old_tree()
832 return xrep_reset_metafile_resv(rr->sc); in xrep_rtrmap_remove_old_tree()
867 struct xrep_rtrmap *rr; in xrep_rtrmapbt_live_update() local
874 rr = container_of(nb, struct xrep_rtrmap, rhook.rmap_hook.nb); in xrep_rtrmapbt_live_update()
875 mp = rr->sc->mp; in xrep_rtrmapbt_live_update()
877 if (!xrep_rtrmapbt_want_live_update(&rr->iscan, &p->oinfo)) in xrep_rtrmapbt_live_update()
880 trace_xrep_rmap_live_update(rtg_group(rr->sc->sr.rtg), action, p); in xrep_rtrmapbt_live_update()
886 mutex_lock(&rr->lock); in xrep_rtrmapbt_live_update()
887 mcur = xfs_rtrmapbt_mem_cursor(rr->sc->sr.rtg, tp, &rr->rtrmap_btree); in xrep_rtrmapbt_live_update()
894 error = xfbtree_trans_commit(&rr->rtrmap_btree, tp); in xrep_rtrmapbt_live_update()
899 mutex_unlock(&rr->lock); in xrep_rtrmapbt_live_update()
903 xfbtree_trans_cancel(&rr->rtrmap_btree, tp); in xrep_rtrmapbt_live_update()
906 xchk_iscan_abort(&rr->iscan); in xrep_rtrmapbt_live_update()
907 mutex_unlock(&rr->lock); in xrep_rtrmapbt_live_update()
915 struct xrep_rtrmap *rr) in xrep_rtrmap_setup_scan() argument
917 struct xfs_scrub *sc = rr->sc; in xrep_rtrmap_setup_scan()
920 mutex_init(&rr->lock); in xrep_rtrmap_setup_scan()
921 xfsb_bitmap_init(&rr->old_rtrmapbt_blocks); in xrep_rtrmap_setup_scan()
924 error = xfs_rtrmapbt_mem_init(sc->mp, &rr->rtrmap_btree, sc->xmbtp, in xrep_rtrmap_setup_scan()
930 xchk_iscan_start(sc, 30000, 100, &rr->iscan); in xrep_rtrmap_setup_scan()
939 xfs_rmap_hook_setup(&rr->rhook, xrep_rtrmapbt_live_update); in xrep_rtrmap_setup_scan()
940 error = xfs_rmap_hook_add(rtg_group(sc->sr.rtg), &rr->rhook); in xrep_rtrmap_setup_scan()
946 xchk_iscan_teardown(&rr->iscan); in xrep_rtrmap_setup_scan()
947 xfbtree_destroy(&rr->rtrmap_btree); in xrep_rtrmap_setup_scan()
949 xfsb_bitmap_destroy(&rr->old_rtrmapbt_blocks); in xrep_rtrmap_setup_scan()
950 mutex_destroy(&rr->lock); in xrep_rtrmap_setup_scan()
957 struct xrep_rtrmap *rr) in xrep_rtrmap_teardown() argument
959 struct xfs_scrub *sc = rr->sc; in xrep_rtrmap_teardown()
961 xchk_iscan_abort(&rr->iscan); in xrep_rtrmap_teardown()
962 xfs_rmap_hook_del(rtg_group(sc->sr.rtg), &rr->rhook); in xrep_rtrmap_teardown()
963 xchk_iscan_teardown(&rr->iscan); in xrep_rtrmap_teardown()
964 xfbtree_destroy(&rr->rtrmap_btree); in xrep_rtrmap_teardown()
965 xfsb_bitmap_destroy(&rr->old_rtrmapbt_blocks); in xrep_rtrmap_teardown()
966 mutex_destroy(&rr->lock); in xrep_rtrmap_teardown()
974 struct xrep_rtrmap *rr = sc->buf; in xrep_rtrmapbt() local
982 error = xrep_rtrmap_setup_scan(rr); in xrep_rtrmapbt()
987 error = xrep_rtrmap_find_rmaps(rr); in xrep_rtrmapbt()
994 error = xrep_rtrmap_build_new_tree(rr); in xrep_rtrmapbt()
999 error = xrep_rtrmap_remove_old_tree(rr); in xrep_rtrmapbt()
1004 xrep_rtrmap_teardown(rr); in xrep_rtrmapbt()