From: Alex Lyakas <alex.lyakas@zadara.com>
To: linux-btrfs@vger.kernel.org
Cc: alex.lyakas@zadara.com
Subject: [PATCH-RFC] btrfs: for unclustered allocation don't consider ffe_ctl->empty_cluster
Date: Thu, 26 Feb 2026 13:34:19 +0200 [thread overview]
Message-ID: <20260226113419.28687-1-alex.lyakas@zadara.com> (raw)
I encountered an issue when performing unclustered allocation for metadata:
free_space_ctl->free_space = 2MB
ffe_ctl->num_bytes = 4096
ffe_ctl->empty_cluster = 2MB
ffe_ctl->empty_size = 0
So early check for free_space_ctl->free_space skips the block group, even though
it has enough space to do the allocation.
I think when doing unclustered allocation we should not look at ffe_ctl->empty_cluster.
I tested this on stable kernel 6.6.
Signed-off-by: Alex Lyakas <alex.lyakas@zadara.com>
---
fs/btrfs/extent-tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 03cf9f242c70..84b340a67882 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3885,7 +3885,7 @@ static int find_free_extent_unclustered(struct btrfs_block_group *bg,
free_space_ctl = bg->free_space_ctl;
spin_lock(&free_space_ctl->tree_lock);
if (free_space_ctl->free_space <
- ffe_ctl->num_bytes + ffe_ctl->empty_cluster +
+ ffe_ctl->num_bytes +
ffe_ctl->empty_size) {
ffe_ctl->total_free_space = max_t(u64,
ffe_ctl->total_free_space,
--
2.43.0
next reply other threads:[~2026-02-26 11:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 11:34 Alex Lyakas [this message]
2026-02-26 17:37 ` [PATCH-RFC] btrfs: for unclustered allocation don't consider ffe_ctl->empty_cluster Boris Burkov
2026-02-26 18:29 ` Boris Burkov
2026-03-01 10:14 ` Alex Lyakas
2026-03-02 19:43 ` Boris Burkov
2026-03-02 21:49 ` Boris Burkov
2026-03-02 21:59 ` Boris Burkov
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=20260226113419.28687-1-alex.lyakas@zadara.com \
--to=alex.lyakas@zadara.com \
--cc=linux-btrfs@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