Linux XFS filesystem development
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Carlos Maiolino <cem@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/4] xfs: simplify the failure path in xfs_buf_alloc_vmalloc
Date: Mon, 29 Jun 2026 18:51:09 -0700	[thread overview]
Message-ID: <20260630015109.GJ6078@frogsfrogsfrogs> (raw)
In-Reply-To: <ajkrJHFg4lYeWskS@nidhogg.toxiclabs.cc>

On Mon, Jun 22, 2026 at 02:34:10PM +0200, Carlos Maiolino wrote:
> On Wed, Jun 17, 2026 at 07:58:05AM +0200, Christoph Hellwig wrote:
> > Look at the __GFP_NORETRY flag set for readahead so that we don't
> > have to pass both the gfp_t and the flags in.
> > 
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  fs/xfs/xfs_buf.c | 7 +++----
> >  1 file changed, 3 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index eea2a8757fe1..1ed9f01b3275 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -168,14 +168,13 @@ static int
> >  xfs_buf_alloc_vmalloc(
> >  	struct xfs_buf		*bp,
> >  	size_t			size,
> > -	gfp_t			gfp_mask,
> > -	xfs_buf_flags_t		flags)
> > +	gfp_t			gfp_mask)
> >  {
> >  	for (;;) {
> >  		bp->b_addr = __vmalloc(size, gfp_mask);
> >  		if (bp->b_addr)
> >  			break;
> > -		if (flags & XBF_READ_AHEAD)
> 
> My only concern is that looking at it now, isn't obvious why GRP_NORETRY
> has been set in the first place, perhaps worth adding a comment above
> it? Like:
> 		/* Set during readahead */

I think it's fine as-is, because the state of being in readahead is
something that the caller of xfs_buf_alloc_vmalloc knows, and doesn't
need to share with xfs_buf_alloc_vmalloc itself.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D


> > +		if (gfp_mask & __GFP_NORETRY)
> >  			return -ENOMEM;
> >  		XFS_STATS_INC(bp->b_mount, xb_page_retries);
> >  		memalloc_retry_wait(gfp_mask);
> > @@ -244,7 +243,7 @@ xfs_buf_alloc_backing_mem(
> >  				return 0;
> >  			trace_xfs_buf_backing_fallback(bp, _RET_IP_);
> >  		}
> > -		return xfs_buf_alloc_vmalloc(bp, size, gfp_mask, flags);
> > +		return xfs_buf_alloc_vmalloc(bp, size, gfp_mask);
> >  	}
> 
> Other than the above caveat:
> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> 
> >  
> >  	/*
> > -- 
> > 2.53.0
> > 
> > 
> 

  parent reply	other threads:[~2026-06-30  1:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17  5:58 fix GFP_ flag use in the buffer cache Christoph Hellwig
2026-06-17  5:58 ` [PATCH 1/4] xfs: split up xfs_buf_alloc_backing_mem Christoph Hellwig
2026-06-22 12:17   ` Carlos Maiolino
2026-06-30  0:52   ` Darrick J. Wong
2026-06-17  5:58 ` [PATCH 2/4] xfs: lift setting __GFP_NOFAIL from xfs_buf_alloc_kmem to the caller Christoph Hellwig
2026-06-22 12:22   ` Carlos Maiolino
2026-06-30  0:52   ` Darrick J. Wong
2026-07-01  9:31     ` Carlos Maiolino
2026-07-01 16:03       ` Darrick J. Wong
2026-06-17  5:58 ` [PATCH 3/4] xfs: fix incorrect use of gfp flags in xfs_buf_alloc_backing_mem Christoph Hellwig
2026-06-22 12:31   ` Carlos Maiolino
2026-06-30  1:49   ` Darrick J. Wong
2026-06-30  5:15     ` Christoph Hellwig
2026-06-17  5:58 ` [PATCH 4/4] xfs: simplify the failure path in xfs_buf_alloc_vmalloc Christoph Hellwig
2026-06-22 12:34   ` Carlos Maiolino
2026-06-24  7:41     ` Christoph Hellwig
2026-06-24  8:25       ` Carlos Maiolino
2026-06-30  1:51     ` Darrick J. Wong [this message]
2026-07-01 12:50 ` fix GFP_ flag use in the buffer cache Carlos Maiolino

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=20260630015109.GJ6078@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --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