From: Rik van Riel <riel@surriel.com>
To: linux-kernel@vger.kernel.org
Cc: linux-xfs@vger.kernel.org, Carlos Maiolino <cem@kernel.org>,
"Darrick J. Wong" <djwong@kernel.org>,
Christoph Hellwig <hch@lst.de>,
kernel-team@meta.com, Christian Andres Saide <csaide@meta.com>
Subject: [PATCH] xfs: keep successful near rt allocations
Date: Wed, 4 Nov 2026 10:01:15 -0500 [thread overview]
Message-ID: <20261104100115.36bf7d28@fangorn> (raw)
XFS realtime allocations first attempt to allocate space near where
other parts of a file already are. If that allocation succeeds, it
does not have to do a global search for free space.
Unfortunately, a code cleanup a while ago causes xfs_rtallocate_rtg
to unconditionally do the global search, even when the search for a
nearby extent has succeeded.
Fix it by running the global search only when the near search did
not find available space.
Found by noticing higher kernel CPU use and examining the profile.
Fixes: fd048a1bb391d ("xfs: rework the rtalloc fallback handling")
Cc: stable@vger.kernel.org # v6.12
Reported-by: Christian Andres Saide <csaide@meta.com>
Signed-off-by: Rik van Riel <riel@surriel.com>
---
fs/xfs/xfs_rtalloc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 84efe5a8fb11..31d90828b4e9 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -1997,10 +1997,14 @@ xfs_rtallocate_rtg(
if (error == -ENOSPC) {
xfs_rtbuf_cache_relse(&args);
error = 0;
+ start = 0;
}
}
- if (!error) {
+ /*
+ * Global search, runs when the near search did not find space.
+ */
+ if (!error && !start) {
error = xfs_rtallocate_extent_size(&args, minlen, maxlen, &len,
prod, &rtx);
}
--
2.56.0
next reply other threads:[~2026-11-04 15:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 15:01 Rik van Riel [this message]
2026-11-04 15:45 ` 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=20261104100115.36bf7d28@fangorn \
--to=riel@surriel.com \
--cc=cem@kernel.org \
--cc=csaide@meta.com \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®