Lines Matching full:ri
140 struct xrep_ibt *ri, in xrep_ibt_check_ifree() argument
146 struct xfs_scrub *sc = ri->sc; in xrep_ibt_check_ifree()
151 xfs_agnumber_t agno = ri->sc->sa.pag->pag_agno; in xrep_ibt_check_ifree()
183 struct xrep_ibt *ri) in xrep_ibt_stash() argument
187 if (xchk_should_terminate(ri->sc, &error)) in xrep_ibt_stash()
190 ri->rie.ir_freecount = xfs_inobt_rec_freecount(&ri->rie); in xrep_ibt_stash()
191 if (xfs_inobt_check_irec(ri->sc->sa.pag, &ri->rie) != NULL) in xrep_ibt_stash()
194 if (ri->rie.ir_freecount > 0) in xrep_ibt_stash()
195 ri->finobt_recs++; in xrep_ibt_stash()
197 trace_xrep_ibt_found(ri->sc->mp, ri->sc->sa.pag->pag_agno, &ri->rie); in xrep_ibt_stash()
199 error = xfarray_append(ri->inode_records, &ri->rie); in xrep_ibt_stash()
203 ri->rie.ir_startino = NULLAGINO; in xrep_ibt_stash()
221 struct xrep_ibt *ri, in xrep_ibt_cluster_record() argument
226 struct xfs_scrub *sc = ri->sc; in xrep_ibt_cluster_record()
242 if (ri->rie.ir_startino != NULLAGINO && in xrep_ibt_cluster_record()
243 ri->rie.ir_startino + XFS_INODES_PER_CHUNK <= ir_startino) { in xrep_ibt_cluster_record()
244 error = xrep_ibt_stash(ri); in xrep_ibt_cluster_record()
249 if (ri->rie.ir_startino == NULLAGINO) { in xrep_ibt_cluster_record()
250 ri->rie.ir_startino = ir_startino; in xrep_ibt_cluster_record()
251 ri->rie.ir_free = XFS_INOBT_ALL_FREE; in xrep_ibt_cluster_record()
252 ri->rie.ir_holemask = 0xFFFF; in xrep_ibt_cluster_record()
253 ri->rie.ir_count = 0; in xrep_ibt_cluster_record()
257 ri->icount += nr_inodes; in xrep_ibt_cluster_record()
258 ri->rie.ir_count += nr_inodes; in xrep_ibt_cluster_record()
259 ri->rie.ir_holemask &= ~xfs_inobt_maskn( in xrep_ibt_cluster_record()
267 error = xrep_ibt_check_ifree(ri, cluster_ir_startino, in xrep_ibt_cluster_record()
273 ri->iused++; in xrep_ibt_cluster_record()
274 ri->rie.ir_free &= ~XFS_INOBT_MASK(cluster_base + in xrep_ibt_cluster_record()
289 struct xrep_ibt *ri, in xrep_ibt_process_cluster() argument
294 struct xfs_scrub *sc = ri->sc; in xrep_ibt_process_cluster()
325 error = xrep_ibt_cluster_record(ri, in xrep_ibt_process_cluster()
399 struct xrep_ibt *ri, in xrep_ibt_record_old_btree_blocks() argument
402 if (!xfs_verify_agbext(ri->sc->sa.pag, rec->rm_startblock, in xrep_ibt_record_old_btree_blocks()
406 return xagb_bitmap_set(&ri->old_iallocbt_blocks, rec->rm_startblock, in xrep_ibt_record_old_btree_blocks()
413 struct xrep_ibt *ri, in xrep_ibt_record_inode_blocks() argument
416 struct xfs_mount *mp = ri->sc->mp; in xrep_ibt_record_inode_blocks()
421 error = xrep_ibt_check_inode_ext(ri->sc, rec->rm_startblock, in xrep_ibt_record_inode_blocks()
426 trace_xrep_ibt_walk_rmap(mp, ri->sc->sa.pag->pag_agno, in xrep_ibt_record_inode_blocks()
437 error = xrep_ibt_process_cluster(ri, in xrep_ibt_record_inode_blocks()
452 struct xrep_ibt *ri = priv; in xrep_ibt_walk_rmap() local
455 if (xchk_should_terminate(ri->sc, &error)) in xrep_ibt_walk_rmap()
460 return xrep_ibt_record_old_btree_blocks(ri, rec); in xrep_ibt_walk_rmap()
462 return xrep_ibt_record_inode_blocks(ri, rec); in xrep_ibt_walk_rmap()
475 struct xrep_ibt *ri) in xrep_ibt_find_inodes() argument
477 struct xfs_scrub *sc = ri->sc; in xrep_ibt_find_inodes()
480 ri->rie.ir_startino = NULLAGINO; in xrep_ibt_find_inodes()
484 error = xfs_rmap_query_all(sc->sa.rmap_cur, xrep_ibt_walk_rmap, ri); in xrep_ibt_find_inodes()
490 if (ri->rie.ir_startino != NULLAGINO) in xrep_ibt_find_inodes()
491 return xrep_ibt_stash(ri); in xrep_ibt_find_inodes()
499 struct xrep_ibt *ri) in xrep_ibt_reset_counters() argument
501 struct xfs_scrub *sc = ri->sc; in xrep_ibt_reset_counters()
503 unsigned int freecount = ri->icount - ri->iused; in xrep_ibt_reset_counters()
512 agi->agi_count = cpu_to_be32(ri->icount); in xrep_ibt_reset_counters()
531 struct xrep_ibt *ri = priv; in xrep_fibt_get_records() local
538 error = xfarray_load(ri->inode_records, in xrep_fibt_get_records()
539 ri->array_cur++, irec); in xrep_fibt_get_records()
561 struct xrep_ibt *ri = priv; in xrep_ibt_get_records() local
567 error = xfarray_load(ri->inode_records, ri->array_cur++, irec); in xrep_ibt_get_records()
585 struct xrep_ibt *ri = priv; in xrep_ibt_claim_block() local
587 return xrep_newbt_claim_block(cur, &ri->new_inobt, ptr); in xrep_ibt_claim_block()
597 struct xrep_ibt *ri = priv; in xrep_fibt_claim_block() local
599 return xrep_newbt_claim_block(cur, &ri->new_finobt, ptr); in xrep_fibt_claim_block()
605 struct xrep_ibt *ri) in xrep_ibt_check_overlap() argument
612 foreach_xfarray_idx(ri->inode_records, cur) { in xrep_ibt_check_overlap()
613 if (xchk_should_terminate(ri->sc, &error)) in xrep_ibt_check_overlap()
616 error = xfarray_load(ri->inode_records, cur, &irec); in xrep_ibt_check_overlap()
632 struct xrep_ibt *ri) in xrep_ibt_build_new_trees() argument
634 struct xfs_scrub *sc = ri->sc; in xrep_ibt_build_new_trees()
649 error = xrep_ibt_check_overlap(ri); in xrep_ibt_build_new_trees()
661 xrep_newbt_init_ag(&ri->new_inobt, sc, &XFS_RMAP_OINFO_INOBT, fsbno, in xrep_ibt_build_new_trees()
663 ri->new_inobt.bload.claim_block = xrep_ibt_claim_block; in xrep_ibt_build_new_trees()
664 ri->new_inobt.bload.get_records = xrep_ibt_get_records; in xrep_ibt_build_new_trees()
667 xfs_btree_stage_afakeroot(ino_cur, &ri->new_inobt.afake); in xrep_ibt_build_new_trees()
668 error = xfs_btree_bload_compute_geometry(ino_cur, &ri->new_inobt.bload, in xrep_ibt_build_new_trees()
669 xfarray_length(ri->inode_records)); in xrep_ibt_build_new_trees()
682 xrep_newbt_init_ag(&ri->new_finobt, sc, &XFS_RMAP_OINFO_INOBT, in xrep_ibt_build_new_trees()
684 ri->new_finobt.bload.claim_block = xrep_fibt_claim_block; in xrep_ibt_build_new_trees()
685 ri->new_finobt.bload.get_records = xrep_fibt_get_records; in xrep_ibt_build_new_trees()
688 xfs_btree_stage_afakeroot(fino_cur, &ri->new_finobt.afake); in xrep_ibt_build_new_trees()
690 &ri->new_finobt.bload, ri->finobt_recs); in xrep_ibt_build_new_trees()
700 error = xrep_newbt_alloc_blocks(&ri->new_inobt, in xrep_ibt_build_new_trees()
701 ri->new_inobt.bload.nr_blocks); in xrep_ibt_build_new_trees()
706 error = xrep_newbt_alloc_blocks(&ri->new_finobt, in xrep_ibt_build_new_trees()
707 ri->new_finobt.bload.nr_blocks); in xrep_ibt_build_new_trees()
713 ri->array_cur = XFARRAY_CURSOR_INIT; in xrep_ibt_build_new_trees()
714 error = xfs_btree_bload(ino_cur, &ri->new_inobt.bload, ri); in xrep_ibt_build_new_trees()
720 ri->array_cur = XFARRAY_CURSOR_INIT; in xrep_ibt_build_new_trees()
721 error = xfs_btree_bload(fino_cur, &ri->new_finobt.bload, ri); in xrep_ibt_build_new_trees()
739 error = xrep_ibt_reset_counters(ri); in xrep_ibt_build_new_trees()
745 error = xrep_newbt_commit(&ri->new_finobt); in xrep_ibt_build_new_trees()
749 error = xrep_newbt_commit(&ri->new_inobt); in xrep_ibt_build_new_trees()
762 xrep_newbt_cancel(&ri->new_finobt); in xrep_ibt_build_new_trees()
764 xrep_newbt_cancel(&ri->new_inobt); in xrep_ibt_build_new_trees()
774 struct xrep_ibt *ri) in xrep_ibt_remove_old_trees() argument
776 struct xfs_scrub *sc = ri->sc; in xrep_ibt_remove_old_trees()
785 error = xrep_reap_agblocks(sc, &ri->old_iallocbt_blocks, in xrep_ibt_remove_old_trees()
805 struct xrep_ibt *ri; in xrep_iallocbt() local
815 ri = kzalloc(sizeof(struct xrep_ibt), XCHK_GFP_FLAGS); in xrep_iallocbt()
816 if (!ri) in xrep_iallocbt()
818 ri->sc = sc; in xrep_iallocbt()
829 &ri->inode_records); in xrep_iallocbt()
835 xagb_bitmap_init(&ri->old_iallocbt_blocks); in xrep_iallocbt()
836 error = xrep_ibt_find_inodes(ri); in xrep_iallocbt()
841 error = xrep_ibt_build_new_trees(ri); in xrep_iallocbt()
846 error = xrep_ibt_remove_old_trees(ri); in xrep_iallocbt()
851 xagb_bitmap_destroy(&ri->old_iallocbt_blocks); in xrep_iallocbt()
852 xfarray_destroy(ri->inode_records); in xrep_iallocbt()
854 kfree(ri); in xrep_iallocbt()