public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: linux-xfs@vger.kernel.org, david@fromorbit.com
Subject: Re: [PATCH 2/2] xfs: Limit total allocation request to maximum possible
Date: Mon, 23 Sep 2019 09:11:36 -0400	[thread overview]
Message-ID: <20190923131136.GA9071@bfoster> (raw)
In-Reply-To: <20190923123934.6zigycei3nmwi54x@pegasus.maiolino.io>

On Mon, Sep 23, 2019 at 02:39:34PM +0200, Carlos Maiolino wrote:
> On Wed, Sep 18, 2019 at 08:28:59AM -0400, Brian Foster wrote:
> > On Wed, Sep 18, 2019 at 10:24:53AM +0200, Carlos Maiolino wrote:
> > > The original allocation request may have a total value way beyond
> > > possible limits.
> > > 
> > > Trim it down to the maximum possible if needed
> > > 
> > > Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> > > ---
> > 
> > Confused.. what was wrong with the original bma.total patch that it
> > needs to be replaced?
> 
> At this point in time, what you mean by the 'original' patch? :) Yours? Or
> Dave's?
> 

The original patch I posted..

> If you meant yours, I was just trying to find out a way to fix it without
> modifying the callers, nothing else than that.
> 
> If you meant regarding Dave's proposal, as he tagged his proposal as a /* Hack
> */, I was just looking for ways to change total, instead of cropping it to 0.
> 
> And giving the fact args.total > blen seems unreasonable, giving it will
> certainly tail here, I just thought it might be a reasonable way to change
> args.total value.
> 

I think the code is flaky, but I'm not sure why that's unreasonable. The
intent of args.total is to be larger than the mapping length.

> By no means this patchset was meant to supersede yours or Dave's idea though, I
> was just looking for a different approach, if feasible.
> 
> 
> > I was assuming we'd replace the allocation retry
> > patch with the minlen alignment fixups and combine those with the
> > bma.total patch to fix the problem. Hm?
> > 
> > >  fs/xfs/libxfs/xfs_bmap.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> > > index 07aad70f3931..3aa0bf5cc7e3 100644
> > > --- a/fs/xfs/libxfs/xfs_bmap.c
> > > +++ b/fs/xfs/libxfs/xfs_bmap.c
> > > @@ -3477,6 +3477,11 @@ xfs_bmap_btalloc(
> > >  			error = xfs_bmap_btalloc_filestreams(ap, &args, &blen);
> > >  		else
> > >  			error = xfs_bmap_btalloc_nullfb(ap, &args, &blen);
> > > +
> > > +		/* We can never have total larger than blen, so trim it now */
> > > +		if (args.total > blen)
> > > +			args.total = blen;
> > > +
> > 
> > I don't think this is safe. The reason the original patch only updated
> > certain callers is because those callers only used it for extra blocks
> > that are already incorported into bma.minleft by the bmap layer itself.
> > There are still other callers for which bma.total is specifically
> > intended to be larger than the map size.
> 
> Afaik, yes, but still, total is basically used to attempt an allocation of data
> + metadata on the same AG if possible, reducing args.total to match blen, the
> 'worst' case would be to have an allocation of data + metadata on different ags,
> which, if total is larger than blen, it will fall into that behavior anyway.
> 

Maybe..? There is no requirement that the additional blocks accounted by
args.total be contiguous with the allocation for the mapping, so I don't
see how you could reliably predict that.

Brian

> 
> > 
> > Brian
> > 
> > >  		if (error)
> > >  			return error;
> > >  	} else if (ap->tp->t_flags & XFS_TRANS_LOWMODE) {
> > > -- 
> > > 2.20.1
> > > 
> 
> -- 
> Carlos

  reply	other threads:[~2019-09-23 13:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18  8:24 [PATCH RFC 0/2] A small improvement in the allocation algorithm Carlos Maiolino
2019-09-18  8:24 ` [PATCH 1/2] xfs: cap longest free extent to maximum allocatable Carlos Maiolino
2019-09-18 12:27   ` Brian Foster
2019-09-23 12:25     ` Carlos Maiolino
2019-09-18  8:24 ` [PATCH 2/2] xfs: Limit total allocation request to maximum possible Carlos Maiolino
2019-09-18 12:28   ` Brian Foster
2019-09-23 12:39     ` Carlos Maiolino
2019-09-23 13:11       ` Brian Foster [this message]
2019-09-24  8:07         ` Carlos Maiolino
2019-09-24 20:50   ` Dave Chinner
2019-09-25 11:53     ` Brian Foster

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=20190923131136.GA9071@bfoster \
    --to=bfoster@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox