From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Chandan Babu R <chandan.babu@oracle.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 6/8] xfs: don't ifdef around the exact minlen allocations
Date: Tue, 17 Sep 2024 11:22:43 -0700 [thread overview]
Message-ID: <20240917182243.GG182194@frogsfrogsfrogs> (raw)
In-Reply-To: <20240904053820.2836285-7-hch@lst.de>
On Wed, Sep 04, 2024 at 08:37:57AM +0300, Christoph Hellwig wrote:
> Exact minlen allocations only exist as an error injection tool for debug
> builds. Currently this is implemented using ifdefs, which means the code
> isn't even compiled for non-XFS_DEBUG builds. Enhance the compile test
> coverage by always building the code and use the compilers' dead code
> elimination to remove it from the generated binary instead.
>
> The only downside is that the new bitfield is unconditionally added to
> struct xfs_alloc_args now.
Could you move it to one of the holes in that struct so that we don't
bloat the size of this structure by 4 bytes for everyone? I think some
light reorganization could shrink it from 136 to 128 bytes.
--D
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> fs/xfs/libxfs/xfs_alloc.c | 7 ++-----
> fs/xfs/libxfs/xfs_alloc.h | 2 --
> fs/xfs/libxfs/xfs_bmap.c | 6 ------
> 3 files changed, 2 insertions(+), 13 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index 59326f84f6a571..04f64cf9777e21 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -2766,7 +2766,6 @@ xfs_alloc_commit_autoreap(
> xfs_defer_item_unpause(tp, aarp->dfp);
> }
>
> -#ifdef DEBUG
> /*
> * Check if an AGF has a free extent record whose length is equal to
> * args->minlen.
> @@ -2806,7 +2805,6 @@ xfs_exact_minlen_extent_available(
>
> return error;
> }
> -#endif
>
> /*
> * Decide whether to use this allocation group for this allocation.
> @@ -2880,15 +2878,14 @@ xfs_alloc_fix_freelist(
> if (!xfs_alloc_space_available(args, need, alloc_flags))
> goto out_agbp_relse;
>
> -#ifdef DEBUG
> - if (args->alloc_minlen_only) {
> + if (IS_ENABLED(CONFIG_XFS_DEBUG) && args->alloc_minlen_only) {
> int stat;
>
> error = xfs_exact_minlen_extent_available(args, agbp, &stat);
> if (error || !stat)
> goto out_agbp_relse;
> }
> -#endif
> +
> /*
> * Make the freelist shorter if it's too long.
> *
> diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h
> index fae170825be064..3e927e628f4418 100644
> --- a/fs/xfs/libxfs/xfs_alloc.h
> +++ b/fs/xfs/libxfs/xfs_alloc.h
> @@ -55,9 +55,7 @@ typedef struct xfs_alloc_arg {
> char wasfromfl; /* set if allocation is from freelist */
> struct xfs_owner_info oinfo; /* owner of blocks being allocated */
> enum xfs_ag_resv_type resv; /* block reservation to use */
> -#ifdef DEBUG
> bool alloc_minlen_only; /* allocate exact minlen extent */
> -#endif
> } xfs_alloc_arg_t;
>
> /*
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 36ff4c553ba5f7..2f7cfbacec952b 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -3468,7 +3468,6 @@ xfs_bmap_process_allocated_extent(
> xfs_bmap_alloc_account(ap);
> }
>
> -#ifdef DEBUG
> static int
> xfs_bmap_exact_minlen_extent_alloc(
> struct xfs_bmalloca *ap)
> @@ -3530,11 +3529,6 @@ xfs_bmap_exact_minlen_extent_alloc(
>
> return 0;
> }
> -#else
> -
> -#define xfs_bmap_exact_minlen_extent_alloc(bma) (-EFSCORRUPTED)
> -
> -#endif
>
> /*
> * If we are not low on available data blocks and we are allocating at
> --
> 2.45.2
>
>
next prev parent reply other threads:[~2024-09-17 18:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 5:37 fix a DEBUG-only assert failure in xfs/538 v4 Christoph Hellwig
2024-09-04 5:37 ` [PATCH 1/8] xfs: merge xfs_attr_leaf_try_add into xfs_attr_leaf_addname Christoph Hellwig
2024-09-04 5:37 ` [PATCH 2/8] xfs: return bool from xfs_attr3_leaf_add Christoph Hellwig
2024-09-04 5:37 ` [PATCH 3/8] xfs: distinguish extra split from real ENOSPC from xfs_attr3_leaf_split Christoph Hellwig
2024-09-04 5:37 ` [PATCH 4/8] xfs: distinguish extra split from real ENOSPC from xfs_attr_node_try_addname Christoph Hellwig
2024-09-17 18:19 ` Darrick J. Wong
2024-09-04 5:37 ` [PATCH 5/8] xfs: fold xfs_bmap_alloc_userdata into xfs_bmapi_allocate Christoph Hellwig
2024-09-04 5:37 ` [PATCH 6/8] xfs: don't ifdef around the exact minlen allocations Christoph Hellwig
2024-09-17 18:22 ` Darrick J. Wong [this message]
2024-09-04 5:37 ` [PATCH 7/8] xfs: call xfs_bmap_exact_minlen_extent_alloc from xfs_bmap_btalloc Christoph Hellwig
2024-09-04 5:37 ` [PATCH 8/8] xfs: support lowmode allocations in xfs_bmap_exact_minlen_extent_alloc Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2024-09-18 5:30 fix a DEBUG-only assert failure in xfs/538 v5 Christoph Hellwig
2024-09-18 5:30 ` [PATCH 6/8] xfs: don't ifdef around the exact minlen allocations Christoph Hellwig
2024-09-18 15:40 ` 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=20240917182243.GG182194@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=chandan.babu@oracle.com \
--cc=hch@lst.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox