Re: [PATCH 24/41] xfs_repair: refactor marking of metadata inodes

Darrick J. Wong
2024-12-11T21:17:18Z

On Mon, Dec 09, 2024 at 09:07:04PM -0800, Christoph Hellwig wrote:
> > +mark_inode(
> > + struct xfs_mount *mp,
> > + xfs_ino_t ino)
> > +{
> > + struct ino_tree_node *irec;
> > + int offset;
> > +
> > + irec = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, ino),
> > + XFS_INO_TO_AGINO(mp, ino));
> > +
> > + offset = XFS_INO_TO_AGINO(mp, ino) - irec->ino_startnum;
> > +
> > + add_inode_reached(irec, offset);
>
> Nit: I'd just skip the local offset variable.

Yeah, that does look cleaner:

static void
mark_inode(
struct xfs_mount *mp,
xfs_ino_t ino)
{
struct ino_tree_node *irec =
find_inode_rec(mp, XFS_INO_TO_AGNO(mp, ino),
XFS_INO_TO_AGINO(mp, ino));

add_inode_reached(irec, XFS_INO_TO_AGINO(mp, ino) - irec->ino_startnum);
}

> Otherwise looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

Thanks!

--D