Lines Matching defs:rr

105 	struct xrep_rtrmap	*rr;
117 rr = kzalloc(sizeof(struct xrep_rtrmap), XCHK_GFP_FLAGS);
118 if (!rr)
121 rr->sc = sc;
122 sc->buf = rr;
143 struct xrep_rtrmap *rr,
157 struct xfs_scrub *sc = rr->sc;
164 if (xchk_iscan_aborted(&rr->iscan))
170 mutex_lock(&rr->lock);
171 mcur = xfs_rtrmapbt_mem_cursor(sc->sr.rtg, sc->tp, &rr->rtrmap_btree);
177 error = xfbtree_trans_commit(&rr->rtrmap_btree, sc->tp);
181 mutex_unlock(&rr->lock);
185 xfbtree_trans_cancel(&rr->rtrmap_btree, sc->tp);
187 xchk_iscan_abort(&rr->iscan);
188 mutex_unlock(&rr->lock);
202 struct xrep_rtrmap *rr;
213 return xrep_rtrmap_stash(rf->rr, rf->accum.rm_startblock,
227 struct xfs_mount *mp = rf->rr->sc->mp;
233 rtg_rgno(rf->rr->sc->sr.rtg))
272 struct xrep_rtrmap *rr = rf->rr;
288 cur = xfs_bmbt_init_cursor(rr->sc->mp, rr->sc->tp, ip, XFS_DATA_FORK);
326 struct xrep_rtrmap *rr,
331 .rr = rr,
359 struct xrep_rtrmap *rr,
366 if (rr->sc->ip == ip)
373 error = xrep_rtrmap_scan_dfork(rr, ip);
378 xchk_iscan_mark_visited(&rr->iscan, ip);
391 struct xrep_rtrmap *rr = priv;
394 if (xchk_should_terminate(rr->sc, &error))
398 if (rec->rm_owner != rr->sc->ip->i_ino)
401 error = xrep_check_ino_btree_mapping(rr->sc, rec);
405 return xfsb_bitmap_set(&rr->old_rtrmapbt_blocks,
413 struct xrep_rtrmap *rr,
416 struct xfs_scrub *sc = rr->sc;
423 error = xfs_rmap_query_all(sc->sa.rmap_cur, xrep_rtrmap_walk_rmap, rr);
429 struct xrep_rtrmap *rr;
440 struct xrep_rtrmap *rr = rsr->rr;
443 return xrep_rtrmap_stash(rr, rgbno, len, rsr->owner, 0, 0);
452 struct xrep_rtrmap *rr,
457 .rr = rr,
487 struct xrep_rtrmap *rr)
498 struct xfs_scrub *sc = rr->sc;
513 error = xrep_rtrmap_stash_bitmap(rr, &cow_blocks, &XFS_RMAP_OINFO_COW);
529 struct xrep_rtrmap *rr = priv;
532 error = xrep_rtrmap_check_mapping(rr->sc, rec);
536 rr->nr_records++;
543 struct xrep_rtrmap *rr)
545 struct xfs_scrub *sc = rr->sc;
552 if (xfs_has_rtsb(sc->mp) && rtg_rgno(rr->sc->sr.rtg) == 0) {
553 error = xrep_rtrmap_stash(rr, 0, sc->mp->m_sb.sb_rextsize,
561 error = xrep_rtrmap_find_refcount_rmaps(rr);
585 while ((error = xchk_iscan_iter(&rr->iscan, &ip)) == 1) {
586 error = xrep_rtrmap_scan_inode(rr, ip);
594 xchk_iscan_iter_finish(&rr->iscan);
614 if (xchk_iscan_aborted(&rr->iscan))
619 error = xrep_rtrmap_scan_ag(rr, pag);
633 mcur = xfs_rtrmapbt_mem_cursor(rr->sc->sr.rtg, NULL, &rr->rtrmap_btree);
634 rr->nr_records = 0;
635 error = xfs_rmap_query_all(mcur, xrep_rtrmap_check_record, rr);
652 struct xrep_rtrmap *rr = priv;
660 error = xfs_btree_increment(rr->mcur, 0, &stat);
666 error = xfs_rmap_get_rec(rr->mcur, &cur->bc_rec.r, &stat);
686 struct xrep_rtrmap *rr = priv;
688 return xrep_newbt_claim_block(cur, &rr->new_btree, ptr);
710 struct xrep_rtrmap *rr)
712 struct xfs_scrub *sc = rr->sc;
723 error = xrep_newbt_init_metadir_inode(&rr->new_btree, sc);
727 rr->new_btree.bload.get_records = xrep_rtrmap_get_records;
728 rr->new_btree.bload.claim_block = xrep_rtrmap_claim_block;
729 rr->new_btree.bload.iroot_size = xrep_rtrmap_iroot_size;
732 xfs_btree_stage_ifakeroot(rmap_cur, &rr->new_btree.ifake);
736 &rr->new_btree.bload, rr->nr_records);
752 rr->new_btree.bload.nr_blocks, 0, true);
757 error = xrep_newbt_alloc_blocks(&rr->new_btree,
758 rr->new_btree.bload.nr_blocks);
766 rr->mcur = xfs_rtrmapbt_mem_cursor(sc->sr.rtg, NULL, &rr->rtrmap_btree);
767 error = xfs_btree_goto_left_edge(rr->mcur);
772 rr->new_btree.ifake.if_fork->if_format = XFS_DINODE_FMT_META_BTREE;
773 error = xfs_btree_bload(rmap_cur, &rr->new_btree.bload, rr);
783 xrep_inode_set_nblocks(rr->sc, rr->new_btree.ifake.if_blocks);
785 xfs_btree_del_cursor(rr->mcur, 0);
786 rr->mcur = NULL;
792 xchk_iscan_abort(&rr->iscan);
795 error = xrep_newbt_commit(&rr->new_btree);
802 xfs_btree_del_cursor(rr->mcur, error);
805 xrep_newbt_cancel(&rr->new_btree);
843 struct xrep_rtrmap *rr;
849 rr = container_of(nb, struct xrep_rtrmap, rhook.rmap_hook.nb);
850 mp = rr->sc->mp;
852 if (!xrep_rtrmapbt_want_live_update(&rr->iscan, &p->oinfo))
855 trace_xrep_rmap_live_update(rtg_group(rr->sc->sr.rtg), action, p);
859 mutex_lock(&rr->lock);
860 mcur = xfs_rtrmapbt_mem_cursor(rr->sc->sr.rtg, tp, &rr->rtrmap_btree);
867 error = xfbtree_trans_commit(&rr->rtrmap_btree, tp);
872 mutex_unlock(&rr->lock);
876 xfbtree_trans_cancel(&rr->rtrmap_btree, tp);
878 xchk_iscan_abort(&rr->iscan);
879 mutex_unlock(&rr->lock);
887 struct xrep_rtrmap *rr)
889 struct xfs_scrub *sc = rr->sc;
892 mutex_init(&rr->lock);
893 xfsb_bitmap_init(&rr->old_rtrmapbt_blocks);
896 error = xfs_rtrmapbt_mem_init(sc->mp, &rr->rtrmap_btree, sc->xmbtp,
902 xchk_iscan_start(sc, 30000, 100, &rr->iscan);
911 xfs_rmap_hook_setup(&rr->rhook, xrep_rtrmapbt_live_update);
912 error = xfs_rmap_hook_add(rtg_group(sc->sr.rtg), &rr->rhook);
918 xchk_iscan_teardown(&rr->iscan);
919 xfbtree_destroy(&rr->rtrmap_btree);
921 xfsb_bitmap_destroy(&rr->old_rtrmapbt_blocks);
922 mutex_destroy(&rr->lock);
929 struct xrep_rtrmap *rr)
931 struct xfs_scrub *sc = rr->sc;
933 xchk_iscan_abort(&rr->iscan);
934 xfs_rmap_hook_del(rtg_group(sc->sr.rtg), &rr->rhook);
935 xchk_iscan_teardown(&rr->iscan);
936 xfbtree_destroy(&rr->rtrmap_btree);
937 xfsb_bitmap_destroy(&rr->old_rtrmapbt_blocks);
938 mutex_destroy(&rr->lock);
946 struct xrep_rtrmap *rr = sc->buf;
954 error = xrep_rtrmap_setup_scan(rr);
959 error = xrep_rtrmap_find_rmaps(rr);
966 error = xrep_rtrmap_build_new_tree(rr);
974 error = xrep_reap_metadir_fsblocks(rr->sc, &rr->old_rtrmapbt_blocks);
979 xrep_rtrmap_teardown(rr);