Lines Matching refs:xnr
44 struct xrep_newbt *xnr) in xrep_newbt_estimate_slack() argument
46 struct xfs_scrub *sc = xnr->sc; in xrep_newbt_estimate_slack()
47 struct xfs_btree_bload *bload = &xnr->bload; in xrep_newbt_estimate_slack()
85 struct xrep_newbt *xnr, in xrep_newbt_init_ag() argument
91 memset(xnr, 0, sizeof(struct xrep_newbt)); in xrep_newbt_init_ag()
92 xnr->sc = sc; in xrep_newbt_init_ag()
93 xnr->oinfo = *oinfo; /* structure copy */ in xrep_newbt_init_ag()
94 xnr->alloc_hint = alloc_hint; in xrep_newbt_init_ag()
95 xnr->resv = resv; in xrep_newbt_init_ag()
96 INIT_LIST_HEAD(&xnr->resv_list); in xrep_newbt_init_ag()
97 xnr->bload.max_dirty = XFS_B_TO_FSBT(sc->mp, 256U << 10); /* 256K */ in xrep_newbt_init_ag()
98 xrep_newbt_estimate_slack(xnr); in xrep_newbt_init_ag()
104 struct xrep_newbt *xnr, in xrep_newbt_init_inode() argument
115 xrep_newbt_init_ag(xnr, sc, oinfo, in xrep_newbt_init_inode()
118 xnr->ifake.if_fork = ifp; in xrep_newbt_init_inode()
119 xnr->ifake.if_fork_size = xfs_inode_fork_size(sc->ip, whichfork); in xrep_newbt_init_inode()
129 struct xrep_newbt *xnr, in xrep_newbt_init_bare() argument
132 xrep_newbt_init_ag(xnr, sc, &XFS_RMAP_OINFO_ANY_OWNER, NULLFSBLOCK, in xrep_newbt_init_bare()
142 struct xrep_newbt *xnr, in xrep_newbt_add_blocks() argument
146 struct xfs_mount *mp = xnr->sc->mp; in xrep_newbt_add_blocks()
161 ASSERT(xnr->oinfo.oi_offset == 0); in xrep_newbt_add_blocks()
169 list_add_tail(&resv->list, &xnr->resv_list); in xrep_newbt_add_blocks()
184 struct xrep_newbt *xnr, in xrep_newbt_add_extent() argument
189 struct xfs_mount *mp = xnr->sc->mp; in xrep_newbt_add_extent()
192 .oinfo = xnr->oinfo, in xrep_newbt_add_extent()
195 .resv = xnr->resv, in xrep_newbt_add_extent()
198 return xrep_newbt_add_blocks(xnr, pag, &args); in xrep_newbt_add_extent()
204 struct xrep_newbt *xnr) in xrep_newbt_validate_ag_alloc_hint() argument
206 struct xfs_scrub *sc = xnr->sc; in xrep_newbt_validate_ag_alloc_hint()
207 xfs_agnumber_t agno = XFS_FSB_TO_AGNO(sc->mp, xnr->alloc_hint); in xrep_newbt_validate_ag_alloc_hint()
210 xfs_verify_fsbno(sc->mp, xnr->alloc_hint)) in xrep_newbt_validate_ag_alloc_hint()
213 xnr->alloc_hint = XFS_AGB_TO_FSB(sc->mp, sc->sa.pag->pag_agno, in xrep_newbt_validate_ag_alloc_hint()
220 struct xrep_newbt *xnr, in xrep_newbt_alloc_ag_blocks() argument
223 struct xfs_scrub *sc = xnr->sc; in xrep_newbt_alloc_ag_blocks()
233 .oinfo = xnr->oinfo, in xrep_newbt_alloc_ag_blocks()
237 .resv = xnr->resv, in xrep_newbt_alloc_ag_blocks()
241 xrep_newbt_validate_ag_alloc_hint(xnr); in xrep_newbt_alloc_ag_blocks()
243 if (xnr->alloc_vextent) in xrep_newbt_alloc_ag_blocks()
244 error = xnr->alloc_vextent(sc, &args, xnr->alloc_hint); in xrep_newbt_alloc_ag_blocks()
247 xnr->alloc_hint); in xrep_newbt_alloc_ag_blocks()
257 xnr->oinfo.oi_owner); in xrep_newbt_alloc_ag_blocks()
264 error = xrep_newbt_add_blocks(xnr, sc->sa.pag, &args); in xrep_newbt_alloc_ag_blocks()
269 xnr->alloc_hint = args.fsbno + args.len; in xrep_newbt_alloc_ag_blocks()
282 struct xrep_newbt *xnr) in xrep_newbt_validate_file_alloc_hint() argument
284 struct xfs_scrub *sc = xnr->sc; in xrep_newbt_validate_file_alloc_hint()
286 if (xfs_verify_fsbno(sc->mp, xnr->alloc_hint)) in xrep_newbt_validate_file_alloc_hint()
289 xnr->alloc_hint = XFS_AGB_TO_FSB(sc->mp, 0, XFS_AGFL_BLOCK(sc->mp) + 1); in xrep_newbt_validate_file_alloc_hint()
295 struct xrep_newbt *xnr, in xrep_newbt_alloc_file_blocks() argument
298 struct xfs_scrub *sc = xnr->sc; in xrep_newbt_alloc_file_blocks()
306 .oinfo = xnr->oinfo, in xrep_newbt_alloc_file_blocks()
310 .resv = xnr->resv, in xrep_newbt_alloc_file_blocks()
315 xrep_newbt_validate_file_alloc_hint(xnr); in xrep_newbt_alloc_file_blocks()
317 if (xnr->alloc_vextent) in xrep_newbt_alloc_file_blocks()
318 error = xnr->alloc_vextent(sc, &args, xnr->alloc_hint); in xrep_newbt_alloc_file_blocks()
321 xnr->alloc_hint); in xrep_newbt_alloc_file_blocks()
331 xnr->oinfo.oi_owner); in xrep_newbt_alloc_file_blocks()
339 error = xrep_newbt_add_blocks(xnr, pag, &args); in xrep_newbt_alloc_file_blocks()
345 xnr->alloc_hint = args.fsbno + args.len; in xrep_newbt_alloc_file_blocks()
358 struct xrep_newbt *xnr, in xrep_newbt_alloc_blocks() argument
361 if (xnr->sc->ip) in xrep_newbt_alloc_blocks()
362 return xrep_newbt_alloc_file_blocks(xnr, nr_blocks); in xrep_newbt_alloc_blocks()
363 return xrep_newbt_alloc_ag_blocks(xnr, nr_blocks); in xrep_newbt_alloc_blocks()
372 struct xrep_newbt *xnr, in xrep_newbt_free_extent() argument
376 struct xfs_scrub *sc = xnr->sc; in xrep_newbt_free_extent()
389 free_agbno, free_aglen, xnr->oinfo.oi_owner); in xrep_newbt_free_extent()
407 free_aglen, xnr->oinfo.oi_owner); in xrep_newbt_free_extent()
409 ASSERT(xnr->resv != XFS_AG_RESV_AGFL); in xrep_newbt_free_extent()
410 ASSERT(xnr->resv != XFS_AG_RESV_IGNORE); in xrep_newbt_free_extent()
417 error = xfs_free_extent_later(sc->tp, fsbno, free_aglen, &xnr->oinfo, in xrep_newbt_free_extent()
418 xnr->resv, XFS_FREE_EXTENT_SKIP_DISCARD); in xrep_newbt_free_extent()
428 struct xrep_newbt *xnr, in xrep_newbt_free() argument
431 struct xfs_scrub *sc = xnr->sc; in xrep_newbt_free()
443 list_for_each_entry_safe(resv, n, &xnr->resv_list, list) { in xrep_newbt_free()
446 ret = xrep_newbt_free_extent(xnr, resv, btree_committed); in xrep_newbt_free()
473 list_for_each_entry_safe(resv, n, &xnr->resv_list, list) { in xrep_newbt_free()
481 kmem_cache_free(xfs_ifork_cache, xnr->ifake.if_fork); in xrep_newbt_free()
482 xnr->ifake.if_fork = NULL; in xrep_newbt_free()
494 struct xrep_newbt *xnr) in xrep_newbt_commit() argument
496 return xrep_newbt_free(xnr, true); in xrep_newbt_commit()
506 struct xrep_newbt *xnr) in xrep_newbt_cancel() argument
508 xrep_newbt_free(xnr, false); in xrep_newbt_cancel()
515 struct xrep_newbt *xnr, in xrep_newbt_claim_block() argument
526 resv = list_first_entry(&xnr->resv_list, struct xrep_newbt_resv, list); in xrep_newbt_claim_block()
542 list_move_tail(&resv->list, &xnr->resv_list); in xrep_newbt_claim_block()
545 xnr->oinfo.oi_owner); in xrep_newbt_claim_block()
554 return xrep_defer_finish(xnr->sc); in xrep_newbt_claim_block()
560 struct xrep_newbt *xnr) in xrep_newbt_unused_blocks() argument
565 list_for_each_entry(resv, &xnr->resv_list, list) in xrep_newbt_unused_blocks()