Re: [PATCH 1/3] xfs: refactor agfl length computation function

Christoph Hellwig
2019-12-24T08:31:46Z

> +/*
> + * Compute the minimum length of the AGFL in the given AG. If @pag is NULL,
> + * return the largest possible minimum length.
> + */
> unsigned int
> xfs_alloc_min_freelist(
> struct xfs_mount *mp,
> struct xfs_perag *pag)
> {
> + /* AG btrees have at least 1 level. */
> + static const uint8_t fake_levels[XFS_BTNUM_AGF] = {1, 1, 1};
> + const uint8_t *levels = pag ? pag->pagf_levels : fake_levels;
> unsigned int min_free;

Yikes. This is just the nastiest calling convention possible. Why
not factor out a xfs_alloc_min_freelist_levels helpers that gets the
levels pointer passed, and we get something much saner.