mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Carlos Maiolino <cem@kernel.org>
To: William Theesfeld <william@theesfeld.net>
Cc: "Darrick J . Wong" <djwong@kernel.org>,
	linux-xfs@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] xfs: convert dquot iterator map allocation to kmalloc_objs()
Date: Tue, 2 Jun 2026 16:01:04 +0200	[thread overview]
Message-ID: <ah7iCVsVJO8jpzlS@nidhogg.toxiclabs.cc> (raw)
In-Reply-To: <20260602112508.25581-1-william@theesfeld.net>

On Tue, Jun 02, 2026 at 07:25:08AM -0400, William Theesfeld wrote:
> v1 converted the open-coded kmalloc(N * sizeof(*p), ...) in
> xfs_qm_reset_dqcounts_buf() to kmalloc_array().  Per review feedback
> from Carlos Maiolino on the v1 thread, switch instead to the

Me? Wasn't Christoph?

> kmalloc_objs() helper, which is the preferred form for new XFS code
> and matches the style of recent conversions elsewhere in fs/xfs/.
> 
> While touching this, also drop the __GFP_NOFAIL flag and handle the
> allocation failure explicitly by returning -ENOMEM.  The function
> already has callers that propagate errors out of quotacheck setup,
> so an early -ENOMEM is harmless and avoids relying on the allocator
> to retry forever on memory pressure.
> 
> No functional change for the success path.
> 
> Signed-off-by: William Theesfeld <william@theesfeld.net>
> ---
>  fs/xfs/xfs_qm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 7bd15d9e7..83e8d80bc 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -1170,8 +1170,9 @@ xfs_qm_reset_dqcounts_buf(
>  	if (qip->i_nblocks == 0)
>  		return 0;
>  
> -	map = kmalloc(XFS_DQITER_MAP_SIZE * sizeof(*map),
> -			GFP_KERNEL | __GFP_NOFAIL);
> +	map = kmalloc_objs(*map, XFS_DQITER_MAP_SIZE, GFP_KERNEL);
> +	if (!map)
> +		return -ENOMEM;
>  
>  	lblkno = 0;
>  	maxlblkcnt = XFS_B_TO_FSB(mp, mp->m_super->s_maxbytes);
> -- 
> 2.54.0
> 

      reply	other threads:[~2026-06-02 14:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01 19:18 [PATCH] xfs: convert dquot iterator map allocation to kmalloc_array() William Theesfeld
2026-06-02  5:14 ` Darrick J. Wong
2026-06-02  5:56   ` Christoph Hellwig
2026-06-02 11:25 ` [PATCH v2] xfs: convert dquot iterator map allocation to kmalloc_objs() William Theesfeld
2026-06-02 14:01   ` Carlos Maiolino [this message]

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=ah7iCVsVJO8jpzlS@nidhogg.toxiclabs.cc \
    --to=cem@kernel.org \
    --cc=djwong@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=william@theesfeld.net \
    /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

all inboxes | Powered by JetHome®