From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, david@fromorbit.com, alex@zadara.com
Subject: Re: [PATCH 1/3] xfs: refactor agfl length computation function
Date: Thu, 19 Dec 2019 08:17:23 -0500 [thread overview]
Message-ID: <20191219131723.GC6995@bfoster> (raw)
In-Reply-To: <157669784878.117895.2399564206474502745.stgit@magnolia>
On Wed, Dec 18, 2019 at 11:37:28AM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Refactor xfs_alloc_min_freelist to accept a NULL @pag argument, in which
> case it returns the largest possible minimum length. This will be used
> in an upcoming patch to compute the length of the AGFL at mkfs time.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/libxfs/xfs_alloc.c | 18 +++++++++++++-----
> 1 file changed, 13 insertions(+), 5 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index c284e10af491..fc93fd88ec89 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -2248,24 +2248,32 @@ xfs_alloc_longest_free_extent(
> return pag->pagf_flcount > 0 || pag->pagf_longest > 0;
> }
>
> +/*
> + * 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;
>
> + ASSERT(mp->m_ag_maxlevels > 0);
> +
> /* space needed by-bno freespace btree */
> - min_free = min_t(unsigned int, pag->pagf_levels[XFS_BTNUM_BNOi] + 1,
> + min_free = min_t(unsigned int, levels[XFS_BTNUM_BNOi] + 1,
> mp->m_ag_maxlevels);
> /* space needed by-size freespace btree */
> - min_free += min_t(unsigned int, pag->pagf_levels[XFS_BTNUM_CNTi] + 1,
> + min_free += min_t(unsigned int, levels[XFS_BTNUM_CNTi] + 1,
> mp->m_ag_maxlevels);
> /* space needed reverse mapping used space btree */
> if (xfs_sb_version_hasrmapbt(&mp->m_sb))
> - min_free += min_t(unsigned int,
> - pag->pagf_levels[XFS_BTNUM_RMAPi] + 1,
> - mp->m_rmap_maxlevels);
> + min_free += min_t(unsigned int, levels[XFS_BTNUM_RMAPi] + 1,
> + mp->m_rmap_maxlevels);
>
> return min_free;
> }
>
next prev parent reply other threads:[~2019-12-19 13:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 19:37 [PATCH v5 0/3] xfs: don't commit sunit/swidth updates to disk if that would cause repair failures Darrick J. Wong
2019-12-18 19:37 ` [PATCH 1/3] xfs: refactor agfl length computation function Darrick J. Wong
2019-12-19 13:17 ` Brian Foster [this message]
2019-12-24 8:31 ` Christoph Hellwig
2019-12-18 19:37 ` [PATCH 2/3] xfs: split the sunit parameter update into two parts Darrick J. Wong
2019-12-19 13:18 ` Brian Foster
2019-12-18 19:37 ` [PATCH 3/3] xfs: don't commit sunit/swidth updates to disk if that would cause repair failures Darrick J. Wong
2019-12-19 13:21 ` Brian Foster
2019-12-19 15:39 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191219131723.GC6995@bfoster \
--to=bfoster@redhat.com \
--cc=alex@zadara.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.