Lines Matching full:rr
166 struct xrep_rtrefc *rr, in xrep_rtrefc_stash() argument
180 if (xchk_should_terminate(rr->sc, &error)) in xrep_rtrefc_stash()
185 error = xrep_rtrefc_check_ext(rr->sc, &irec); in xrep_rtrefc_stash()
189 trace_xrep_refc_found(rtg_group(rr->sc->sr.rtg), &irec); in xrep_rtrefc_stash()
191 return xfarray_append(rr->refcount_records, &irec); in xrep_rtrefc_stash()
197 struct xrep_rtrefc *rr, in xrep_rtrefc_stash_cow() argument
201 return xrep_rtrefc_stash(rr, XFS_REFC_DOMAIN_COW, bno, len, 1); in xrep_rtrefc_stash_cow()
223 struct xrep_rtrefc *rr, in xrep_rtrefc_walk_rmaps() argument
227 struct xfs_btree_cur *cur = rr->sc->sr.rmap_cur; in xrep_rtrefc_walk_rmaps()
241 if (xchk_should_terminate(rr->sc, &error)) in xrep_rtrefc_walk_rmaps()
259 error = xrep_rtrefc_stash_cow(rr, rmap->rm_startblock, in xrep_rtrefc_walk_rmaps()
317 struct xrep_rtrefc *rr) in xrep_rtrefc_sort_records() argument
325 error = xfarray_sort(rr->refcount_records, xrep_rtrefc_extent_cmp, in xrep_rtrefc_sort_records()
330 foreach_xfarray_idx(rr->refcount_records, cur) { in xrep_rtrefc_sort_records()
331 if (xchk_should_terminate(rr->sc, &error)) in xrep_rtrefc_sort_records()
334 error = xfarray_load(rr->refcount_records, cur, &irec); in xrep_rtrefc_sort_records()
362 struct xrep_rtrefc *rr = priv; in xrep_rtrefc_walk_rmap() local
365 if (xchk_should_terminate(rr->sc, &error)) in xrep_rtrefc_walk_rmap()
369 if (rec->rm_owner != rr->sc->ip->i_ino) in xrep_rtrefc_walk_rmap()
372 error = xrep_check_ino_btree_mapping(rr->sc, rec); in xrep_rtrefc_walk_rmap()
376 return xfsb_bitmap_set(&rr->old_rtrefcountbt_blocks, in xrep_rtrefc_walk_rmap()
389 struct xrep_rtrefc *rr, in xrep_rtrefc_push_rmaps_at() argument
395 struct xfs_scrub *sc = rr->sc; in xrep_rtrefc_push_rmaps_at()
400 error = rcbag_add(rcstack, rr->sc->tp, rmap); in xrep_rtrefc_push_rmaps_at()
404 error = xrep_rtrefc_walk_rmaps(rr, rmap, have); in xrep_rtrefc_push_rmaps_at()
423 struct xrep_rtrefc *rr, in xrep_rtrefc_scan_ag() argument
426 struct xfs_scrub *sc = rr->sc; in xrep_rtrefc_scan_ag()
433 error = xfs_rmap_query_all(sc->sa.rmap_cur, xrep_rtrefc_walk_rmap, rr); in xrep_rtrefc_scan_ag()
441 struct xrep_rtrefc *rr) in xrep_rtrefc_find_refcounts() argument
443 struct xfs_scrub *sc = rr->sc; in xrep_rtrefc_find_refcounts()
455 error = xrep_rtrefc_scan_ag(rr, pag); in xrep_rtrefc_find_refcounts()
483 error = xrep_rtrefc_walk_rmaps(rr, &rmap, &have); in xrep_rtrefc_find_refcounts()
489 error = xrep_rtrefc_push_rmaps_at(rr, rcstack, sbno, &rmap, in xrep_rtrefc_find_refcounts()
510 error = xrep_rtrefc_walk_rmaps(rr, &rmap, &have); in xrep_rtrefc_find_refcounts()
514 error = xrep_rtrefc_push_rmaps_at(rr, rcstack, in xrep_rtrefc_find_refcounts()
524 error = xrep_rtrefc_stash(rr, in xrep_rtrefc_find_refcounts()
567 struct xrep_rtrefc *rr = priv; in xrep_rtrefc_get_records() local
573 error = xfarray_load(rr->refcount_records, rr->array_cur++, in xrep_rtrefc_get_records()
592 struct xrep_rtrefc *rr = priv; in xrep_rtrefc_claim_block() local
594 return xrep_newbt_claim_block(cur, &rr->new_btree, ptr); in xrep_rtrefc_claim_block()
616 struct xrep_rtrefc *rr) in xrep_rtrefc_build_new_tree() argument
618 struct xfs_scrub *sc = rr->sc; in xrep_rtrefc_build_new_tree()
623 error = xrep_rtrefc_sort_records(rr); in xrep_rtrefc_build_new_tree()
633 error = xrep_newbt_init_metadir_inode(&rr->new_btree, sc); in xrep_rtrefc_build_new_tree()
637 rr->new_btree.bload.get_records = xrep_rtrefc_get_records; in xrep_rtrefc_build_new_tree()
638 rr->new_btree.bload.claim_block = xrep_rtrefc_claim_block; in xrep_rtrefc_build_new_tree()
639 rr->new_btree.bload.iroot_size = xrep_rtrefc_iroot_size; in xrep_rtrefc_build_new_tree()
642 xfs_btree_stage_ifakeroot(refc_cur, &rr->new_btree.ifake); in xrep_rtrefc_build_new_tree()
645 error = xfs_btree_bload_compute_geometry(refc_cur, &rr->new_btree.bload, in xrep_rtrefc_build_new_tree()
646 xfarray_length(rr->refcount_records)); in xrep_rtrefc_build_new_tree()
662 rr->new_btree.bload.nr_blocks, 0, true); in xrep_rtrefc_build_new_tree()
667 error = xrep_newbt_alloc_blocks(&rr->new_btree, in xrep_rtrefc_build_new_tree()
668 rr->new_btree.bload.nr_blocks); in xrep_rtrefc_build_new_tree()
673 rr->new_btree.ifake.if_fork->if_format = XFS_DINODE_FMT_META_BTREE; in xrep_rtrefc_build_new_tree()
674 rr->array_cur = XFARRAY_CURSOR_INIT; in xrep_rtrefc_build_new_tree()
675 error = xfs_btree_bload(refc_cur, &rr->new_btree.bload, rr); in xrep_rtrefc_build_new_tree()
685 xrep_inode_set_nblocks(rr->sc, rr->new_btree.ifake.if_blocks); in xrep_rtrefc_build_new_tree()
689 error = xrep_newbt_commit(&rr->new_btree); in xrep_rtrefc_build_new_tree()
696 xrep_newbt_cancel(&rr->new_btree); in xrep_rtrefc_build_new_tree()
706 struct xrep_rtrefc *rr) in xrep_rtrefc_remove_old_tree() argument
714 error = xrep_reap_metadir_fsblocks(rr->sc, in xrep_rtrefc_remove_old_tree()
715 &rr->old_rtrefcountbt_blocks); in xrep_rtrefc_remove_old_tree()
723 return xrep_reset_metafile_resv(rr->sc); in xrep_rtrefc_remove_old_tree()
731 struct xrep_rtrefc *rr; in xrep_rtrefcountbt() local
745 rr = kzalloc(sizeof(struct xrep_rtrefc), XCHK_GFP_FLAGS); in xrep_rtrefcountbt()
746 if (!rr) in xrep_rtrefcountbt()
748 rr->sc = sc; in xrep_rtrefcountbt()
754 &rr->refcount_records); in xrep_rtrefcountbt()
760 xfsb_bitmap_init(&rr->old_rtrefcountbt_blocks); in xrep_rtrefcountbt()
761 error = xrep_rtrefc_find_refcounts(rr); in xrep_rtrefcountbt()
768 error = xrep_rtrefc_build_new_tree(rr); in xrep_rtrefcountbt()
773 error = xrep_rtrefc_remove_old_tree(rr); in xrep_rtrefcountbt()
778 xfsb_bitmap_destroy(&rr->old_rtrefcountbt_blocks); in xrep_rtrefcountbt()
779 xfarray_destroy(rr->refcount_records); in xrep_rtrefcountbt()
781 kfree(rr); in xrep_rtrefcountbt()