Lines Matching full:rr

166 	struct xrep_rmap	*rr;  in xrep_setup_ag_rmapbt()  local
178 rr = kzalloc(sizeof(struct xrep_rmap), XCHK_GFP_FLAGS); in xrep_setup_ag_rmapbt()
179 if (!rr) in xrep_setup_ag_rmapbt()
182 rr->sc = sc; in xrep_setup_ag_rmapbt()
183 sc->buf = rr; in xrep_setup_ag_rmapbt()
213 struct xrep_rmap *rr, in xrep_rmap_stash() argument
227 struct xfs_scrub *sc = rr->sc; in xrep_rmap_stash()
234 if (xchk_iscan_aborted(&rr->iscan)) in xrep_rmap_stash()
239 mutex_lock(&rr->lock); in xrep_rmap_stash()
240 mcur = xfs_rmapbt_mem_cursor(sc->sa.pag, sc->tp, &rr->rmap_btree); in xrep_rmap_stash()
246 error = xfbtree_trans_commit(&rr->rmap_btree, sc->tp); in xrep_rmap_stash()
250 mutex_unlock(&rr->lock); in xrep_rmap_stash()
254 xfbtree_trans_cancel(&rr->rmap_btree, sc->tp); in xrep_rmap_stash()
256 xchk_iscan_abort(&rr->iscan); in xrep_rmap_stash()
257 mutex_unlock(&rr->lock); in xrep_rmap_stash()
262 struct xrep_rmap *rr; member
274 struct xrep_rmap *rr = rsr->rr; in xrep_rmap_stash_run() local
276 return xrep_rmap_stash(rr, start, len, rsr->owner, 0, rsr->rmap_flags); in xrep_rmap_stash_run()
285 struct xrep_rmap *rr, in xrep_rmap_stash_bitmap() argument
290 .rr = rr, in xrep_rmap_stash_bitmap()
316 struct xrep_rmap *rr; member
330 return xrep_rmap_stash(rf->rr, rf->accum.rm_startblock, in xrep_rmap_stash_accumulated()
343 struct xfs_mount *mp = rf->rr->sc->mp; in xrep_rmap_visit_bmbt()
350 pag_agno(rf->rr->sc->sa.pag)) in xrep_rmap_visit_bmbt()
397 if (XFS_FSB_TO_AGNO(cur->bc_mp, fsbno) != pag_agno(rf->rr->sc->sa.pag)) in xrep_rmap_visit_iroot_btree_block()
414 struct xrep_rmap *rr = rf->rr; in xrep_rmap_scan_iroot_btree() local
427 error = xrep_rmap_stash_bitmap(rr, &rf->bmbt_blocks, &oinfo); in xrep_rmap_scan_iroot_btree()
449 struct xrep_rmap *rr = rf->rr; in xrep_rmap_scan_bmbt() local
456 cur = xfs_bmbt_init_cursor(rr->sc->mp, rr->sc->tp, ip, rf->whichfork); in xrep_rmap_scan_bmbt()
510 struct xfs_scrub *sc = rf->rr->sc; in xrep_rmap_scan_meta_btree()
571 struct xrep_rmap *rr, in xrep_rmap_scan_ifork() argument
577 .rr = rr, in xrep_rmap_scan_ifork()
639 struct xrep_rmap *rr, in xrep_rmap_scan_inode() argument
646 error = xrep_rmap_scan_ifork(rr, ip, XFS_DATA_FORK); in xrep_rmap_scan_inode()
651 error = xrep_rmap_scan_ifork(rr, ip, XFS_ATTR_FORK); in xrep_rmap_scan_inode()
657 xchk_iscan_mark_visited(&rr->iscan, ip); in xrep_rmap_scan_inode()
666 struct xrep_rmap *rr; member
732 struct xrep_rmap *rr) in xrep_rmap_find_inode_rmaps() argument
735 .rr = rr, in xrep_rmap_find_inode_rmaps()
737 struct xfs_scrub *sc = rr->sc; in xrep_rmap_find_inode_rmaps()
773 error = xrep_rmap_stash_bitmap(rr, &ri.inobt_blocks, in xrep_rmap_find_inode_rmaps()
777 error = xrep_rmap_stash_bitmap(rr, &ri.ichunk_blocks, in xrep_rmap_find_inode_rmaps()
808 struct xrep_rmap *rr) in xrep_rmap_find_refcount_rmaps() argument
820 struct xfs_scrub *sc = rr->sc; in xrep_rmap_find_refcount_rmaps()
841 error = xrep_rmap_stash_bitmap(rr, &cow_blocks, &XFS_RMAP_OINFO_COW); in xrep_rmap_find_refcount_rmaps()
844 error = xrep_rmap_stash_bitmap(rr, &refcountbt_blocks, in xrep_rmap_find_refcount_rmaps()
856 struct xrep_rmap *rr) in xrep_rmap_find_agheader_rmaps() argument
858 struct xfs_scrub *sc = rr->sc; in xrep_rmap_find_agheader_rmaps()
861 return xrep_rmap_stash(rr, XFS_SB_BLOCK(sc->mp), in xrep_rmap_find_agheader_rmaps()
869 struct xrep_rmap *rr) in xrep_rmap_find_log_rmaps() argument
871 struct xfs_scrub *sc = rr->sc; in xrep_rmap_find_log_rmaps()
876 return xrep_rmap_stash(rr, in xrep_rmap_find_log_rmaps()
888 struct xrep_rmap *rr = priv; in xrep_rmap_check_record() local
891 error = xrep_rmap_check_mapping(rr->sc, rec); in xrep_rmap_check_record()
895 rr->nr_records++; in xrep_rmap_check_record()
907 struct xrep_rmap *rr) in xrep_rmap_find_rmaps() argument
909 struct xfs_scrub *sc = rr->sc; in xrep_rmap_find_rmaps()
918 error = xrep_rmap_find_inode_rmaps(rr); in xrep_rmap_find_rmaps()
922 error = xrep_rmap_find_refcount_rmaps(rr); in xrep_rmap_find_rmaps()
926 error = xrep_rmap_find_agheader_rmaps(rr); in xrep_rmap_find_rmaps()
930 error = xrep_rmap_find_log_rmaps(rr); in xrep_rmap_find_rmaps()
959 while ((error = xchk_iscan_iter(&rr->iscan, &ip)) == 1) { in xrep_rmap_find_rmaps()
960 error = xrep_rmap_scan_inode(rr, ip); in xrep_rmap_find_rmaps()
968 xchk_iscan_iter_finish(&rr->iscan); in xrep_rmap_find_rmaps()
988 if (xchk_iscan_aborted(&rr->iscan)) in xrep_rmap_find_rmaps()
998 mcur = xfs_rmapbt_mem_cursor(rr->sc->sa.pag, NULL, &rr->rmap_btree); in xrep_rmap_find_rmaps()
1002 rr->nr_records = 0; in xrep_rmap_find_rmaps()
1003 error = xfs_rmap_query_all(mcur, xrep_rmap_check_record, rr); in xrep_rmap_find_rmaps()
1040 struct xrep_rmap *rr, in xrep_rmap_try_reserve() argument
1048 .agno = pag_agno(rr->sc->sa.pag), in xrep_rmap_try_reserve()
1050 struct xfs_scrub *sc = rr->sc; in xrep_rmap_try_reserve()
1065 nr_blocks = rr->new_btree.bload.nr_blocks; in xrep_rmap_try_reserve()
1073 error = xrep_newbt_alloc_blocks(&rr->new_btree, in xrep_rmap_try_reserve()
1078 *blocks_reserved = rr->new_btree.bload.nr_blocks; in xrep_rmap_try_reserve()
1102 rr->freesp_btblocks = xagb_bitmap_hweight(freesp_blocks) - 2; in xrep_rmap_try_reserve()
1105 list_for_each_entry_safe(resv, n, &rr->new_btree.resv_list, list) { in xrep_rmap_try_reserve()
1125 &rr->new_btree.bload, rr->nr_records + freesp_records); in xrep_rmap_try_reserve()
1130 *done = nr_blocks >= rr->new_btree.bload.nr_blocks; in xrep_rmap_try_reserve()
1140 struct xrep_rmap *rr, in xrep_rmap_reserve_space() argument
1150 &rr->new_btree.bload, rr->nr_records); in xrep_rmap_reserve_space()
1155 if (xchk_should_terminate(rr->sc, &error)) in xrep_rmap_reserve_space()
1167 error = xrep_rmap_try_reserve(rr, rmap_cur, &freesp_blocks, in xrep_rmap_reserve_space()
1174 xrep_ag_btcur_init(rr->sc, &rr->sc->sa); in xrep_rmap_reserve_space()
1175 error = xrep_rmap_stash_bitmap(rr, &freesp_blocks, &XFS_RMAP_OINFO_AG); in xrep_rmap_reserve_space()
1176 xchk_ag_btcur_free(&rr->sc->sa); in xrep_rmap_reserve_space()
1188 struct xrep_rmap *rr) in xrep_rmap_reset_counters() argument
1190 struct xfs_scrub *sc = rr->sc; in xrep_rmap_reset_counters()
1199 rmap_btblocks = rr->new_btree.afake.af_blocks - 1; in xrep_rmap_reset_counters()
1200 agf->agf_btreeblks = cpu_to_be32(rr->freesp_btblocks + rmap_btblocks); in xrep_rmap_reset_counters()
1229 struct xrep_rmap *rr = priv; in xrep_rmap_get_records() local
1237 error = xfs_btree_increment(rr->mcur, 0, &stat); in xrep_rmap_get_records()
1243 error = xfs_rmap_get_rec(rr->mcur, &cur->bc_rec.r, &stat); in xrep_rmap_get_records()
1263 struct xrep_rmap *rr = priv; in xrep_rmap_claim_block() local
1265 return xrep_newbt_claim_block(cur, &rr->new_btree, ptr); in xrep_rmap_claim_block()
1338 struct xrep_rmap *rr) in xrep_rmap_build_new_tree() argument
1340 struct xfs_scrub *sc = rr->sc; in xrep_rmap_build_new_tree()
1351 rr->old_rmapbt_fsbcount = be32_to_cpu(agf->agf_rmap_blocks); in xrep_rmap_build_new_tree()
1361 xrep_newbt_init_ag(&rr->new_btree, sc, &XFS_RMAP_OINFO_SKIP_UPDATE, in xrep_rmap_build_new_tree()
1364 rr->new_btree.bload.get_records = xrep_rmap_get_records; in xrep_rmap_build_new_tree()
1365 rr->new_btree.bload.claim_block = xrep_rmap_claim_block; in xrep_rmap_build_new_tree()
1366 rr->new_btree.alloc_vextent = xrep_rmap_alloc_vextent; in xrep_rmap_build_new_tree()
1368 xfs_btree_stage_afakeroot(rmap_cur, &rr->new_btree.afake); in xrep_rmap_build_new_tree()
1371 * Initialize @rr->new_btree, reserve space for the new rmapbt, in xrep_rmap_build_new_tree()
1374 error = xrep_rmap_reserve_space(rr, rmap_cur); in xrep_rmap_build_new_tree()
1382 rr->mcur = xfs_rmapbt_mem_cursor(rr->sc->sa.pag, NULL, in xrep_rmap_build_new_tree()
1383 &rr->rmap_btree); in xrep_rmap_build_new_tree()
1385 error = xrep_rmap_count_records(rr->mcur, &rr->nr_records); in xrep_rmap_build_new_tree()
1395 pag->pagf_repair_rmap_level = rr->new_btree.bload.btree_height; in xrep_rmap_build_new_tree()
1401 error = xfs_btree_goto_left_edge(rr->mcur); in xrep_rmap_build_new_tree()
1406 error = xfs_btree_bload(rmap_cur, &rr->new_btree.bload, rr); in xrep_rmap_build_new_tree()
1416 xfs_btree_del_cursor(rr->mcur, 0); in xrep_rmap_build_new_tree()
1417 rr->mcur = NULL; in xrep_rmap_build_new_tree()
1423 xchk_iscan_abort(&rr->iscan); in xrep_rmap_build_new_tree()
1431 rr->new_btree.oinfo = XFS_RMAP_OINFO_AG; in xrep_rmap_build_new_tree()
1434 error = xrep_rmap_reset_counters(rr); in xrep_rmap_build_new_tree()
1439 error = xrep_newbt_commit(&rr->new_btree); in xrep_rmap_build_new_tree()
1448 xfs_btree_del_cursor(rr->mcur, error); in xrep_rmap_build_new_tree()
1452 xrep_newbt_cancel(&rr->new_btree); in xrep_rmap_build_new_tree()
1506 struct xrep_rmap *rr) in xrep_rmap_remove_old_tree() argument
1511 struct xfs_scrub *sc = rr->sc; in xrep_rmap_remove_old_tree()
1521 mcur = xfs_rmapbt_mem_cursor(rr->sc->sa.pag, NULL, &rr->rmap_btree); in xrep_rmap_remove_old_tree()
1611 struct xrep_rmap *rr; in xrep_rmapbt_live_update() local
1618 rr = container_of(nb, struct xrep_rmap, rhook.rmap_hook.nb); in xrep_rmapbt_live_update()
1619 mp = rr->sc->mp; in xrep_rmapbt_live_update()
1621 if (!xrep_rmapbt_want_live_update(&rr->iscan, &p->oinfo)) in xrep_rmapbt_live_update()
1624 trace_xrep_rmap_live_update(pag_group(rr->sc->sa.pag), action, p); in xrep_rmapbt_live_update()
1630 mutex_lock(&rr->lock); in xrep_rmapbt_live_update()
1631 mcur = xfs_rmapbt_mem_cursor(rr->sc->sa.pag, tp, &rr->rmap_btree); in xrep_rmapbt_live_update()
1638 error = xfbtree_trans_commit(&rr->rmap_btree, tp); in xrep_rmapbt_live_update()
1643 mutex_unlock(&rr->lock); in xrep_rmapbt_live_update()
1647 xfbtree_trans_cancel(&rr->rmap_btree, tp); in xrep_rmapbt_live_update()
1650 mutex_unlock(&rr->lock); in xrep_rmapbt_live_update()
1651 xchk_iscan_abort(&rr->iscan); in xrep_rmapbt_live_update()
1659 struct xrep_rmap *rr) in xrep_rmap_setup_scan() argument
1661 struct xfs_scrub *sc = rr->sc; in xrep_rmap_setup_scan()
1664 mutex_init(&rr->lock); in xrep_rmap_setup_scan()
1667 error = xfs_rmapbt_mem_init(sc->mp, &rr->rmap_btree, sc->xmbtp, in xrep_rmap_setup_scan()
1673 xchk_iscan_start(sc, 30000, 100, &rr->iscan); in xrep_rmap_setup_scan()
1682 xfs_rmap_hook_setup(&rr->rhook, xrep_rmapbt_live_update); in xrep_rmap_setup_scan()
1683 error = xfs_rmap_hook_add(pag_group(sc->sa.pag), &rr->rhook); in xrep_rmap_setup_scan()
1689 xchk_iscan_teardown(&rr->iscan); in xrep_rmap_setup_scan()
1690 xfbtree_destroy(&rr->rmap_btree); in xrep_rmap_setup_scan()
1692 mutex_destroy(&rr->lock); in xrep_rmap_setup_scan()
1699 struct xrep_rmap *rr) in xrep_rmap_teardown() argument
1701 struct xfs_scrub *sc = rr->sc; in xrep_rmap_teardown()
1703 xchk_iscan_abort(&rr->iscan); in xrep_rmap_teardown()
1704 xfs_rmap_hook_del(pag_group(sc->sa.pag), &rr->rhook); in xrep_rmap_teardown()
1705 xchk_iscan_teardown(&rr->iscan); in xrep_rmap_teardown()
1706 xfbtree_destroy(&rr->rmap_btree); in xrep_rmap_teardown()
1707 mutex_destroy(&rr->lock); in xrep_rmap_teardown()
1715 struct xrep_rmap *rr = sc->buf; in xrep_rmapbt() local
1718 error = xrep_rmap_setup_scan(rr); in xrep_rmapbt()
1726 error = xrep_rmap_find_rmaps(rr); in xrep_rmapbt()
1731 error = xrep_rmap_build_new_tree(rr); in xrep_rmapbt()
1736 error = xrep_rmap_remove_old_tree(rr); in xrep_rmapbt()
1741 xrep_rmap_teardown(rr); in xrep_rmapbt()