Re: [PATCH 32/37] xfs: online repair of the realtime rmap btree

Christoph Hellwig
2024-12-13T07:29:16Z

> Repair the realtime rmap btree while mounted.

And actual description of how this repair works, and the changes to the
non-repair code required for it would be kinda useful.

> xchk_setup_rt(
> struct xfs_scrub *sc)
> {
> - return xchk_trans_alloc(sc, 0);
> + uint resblks;
> +
> + resblks = xrep_calc_rtgroup_resblks(sc);
> + return xchk_trans_alloc(sc, resblks);

This would be a tad cleaner without the local variable.

> +
> + if (!(sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR))
> + return 0;
> +
> + rtg = xfs_rtgroup_get(mp, sm->sm_agno);
> + usedlen = rtg->rtg_extents * mp->m_sb.sb_rextsize;
> + xfs_rtgroup_put(rtg);

Couldn't this use xfs_rtgroup_extents to avoid the rtg lookup?
If not it should probable use rtg_blocks().

> + struct xfs_scrub *sc,
> + int64_t new_blocks)
> +{
> + int64_t delta;
> +
> + delta = new_blocks - sc->ip->i_nblocks;

int64_6 delta = new_blocks - sc->ip->i_nblocks;

?