Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Matt Fleming <matt@readmodwrite.com>
Subject: [PATCH 0/2] xfs: fix a couple sparse chunk alloc problems
Date: Fri, 31 Jul 2026 12:33:35 -0400	[thread overview]
Message-ID: <20260731163337.152522-1-bfoster@redhat.com> (raw)

Hi all,

This series is a couple small sparse chunk alloc related fixes. Patch 1
is LLM detected and generated (I rewrote the commit log) during the
process of investigating the problem fixed by the second. Patch 2 fixes
the problem reported by Matt here [1].

Note that patch 2 is semi-RFC. Personally I'm Ok with using this as the
fix, but I don't love it and recognize that it's more of a band-aid. The
fundamental problem seems more that the space availability requirements
change within a transaction that targets a single AG, but I haven't yet
thought of an elegant enough way to fix that for something that is kind
of a corner case.

The LLM came up with a fix that basically bumps up minleft within the
allocator path by the extra space that would be required by the inobt
allocation, but I didn't really like that at all and tossed it in favor
of this.

I had a couple other things I thought about as potential alternatives.
One is to perhaps use or repurpose something like the
XFS_ALLOC_FLAG_FREEING flag for this pattern where we have a minleft
gated allocation followed by a targeted alloc to the same AG. This would
presumably allow the allocation to succeed.

Another is to perhaps enhance the xfs_alloc_min_freelist() logic to just
start to use the allocbt maxlevels value for requirements calculation as
an AG starts to approach -ENOSPC. That is more of a heuristic and
similar sort of workaround for the problem, but more directly encodes
that reliability is priority over squeezing every last block from an AG.
I also think it's a little risky as it may involve a new mode of
allocation across the board (not just sparse chunk allocs).

I also suspect this wouldn't be a problem if the inobt were covered as
perag metadata res the way the finobt is, but I haven't thought that
through fully.

So all in all I'm curious what folks think about any of this or have any
other potential ideas. My main concern is that I don't want to introduce
something too complex for the single uncommon use case of sparse inodes.
I.e., this problem seems a lot like a corner case of a corner case to
me. Thoughts?

Brian

[1] https://lore.kernel.org/linux-xfs/20260717130429.1838767-1-matt@readmodwrite.com/

Brian Foster (2):
  xfs: set minleft correctly for sparse chunk errortag allocation
  xfs: consistent low ag space behavior for sparse inode chunk allocs

 fs/xfs/libxfs/xfs_ialloc.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

-- 
2.55.0


             reply	other threads:[~2026-07-31 16:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31 16:33 Brian Foster [this message]
2026-07-31 16:33 ` [PATCH 1/2] xfs: set minleft correctly for sparse chunk errortag allocation Brian Foster
2026-07-31 18:02   ` [External] : " Mark Tinguely
2026-07-31 18:40     ` Brian Foster
2026-07-31 16:33 ` [PATCH 2/2] xfs: consistent low ag space behavior for sparse inode chunk allocs Brian Foster
2026-07-31 17:54   ` [External] : " Mark Tinguely
2026-08-01  0:11   ` Dave Chinner

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=20260731163337.152522-1-bfoster@redhat.com \
    --to=bfoster@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=matt@readmodwrite.com \
    /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