From: Sun YangKai <sunk67188@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Sun YangKai <sunk67188@gmail.com>
Subject: [PATCH 6/7] btrfs: clarify reclaim sweep control flow
Date: Wed, 31 Dec 2025 18:39:39 +0800 [thread overview]
Message-ID: <20251231111623.30136-7-sunk67188@gmail.com> (raw)
In-Reply-To: <20251231111623.30136-1-sunk67188@gmail.com>
Replace the try_again flag with will_reclaim and adjust the
to better reflect the intent of the logic. This makes the reclaim
decision easier to follow without changing behavior.
Also prepare for the next patch.
No functional change.
Signed-off-by: Sun YangKai <sunk67188@gmail.com>
---
fs/btrfs/space-info.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index cf2c4b7105cf..b6ec09aea64f 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -2083,7 +2083,7 @@ static void do_reclaim_sweep(struct btrfs_space_info *space_info, int raid)
{
struct btrfs_block_group *bg;
int thresh_pct;
- bool try_again = true;
+ bool will_reclaim = false;
bool urgent;
spin_lock(&space_info->lock);
@@ -2101,7 +2101,7 @@ static void do_reclaim_sweep(struct btrfs_space_info *space_info, int raid)
spin_lock(&bg->lock);
thresh = mult_perc(bg->length, thresh_pct);
if (bg->used < thresh && bg->reclaim_mark) {
- try_again = false;
+ will_reclaim = true;
reclaim = true;
}
bg->reclaim_mark = true;
@@ -2118,8 +2118,8 @@ static void do_reclaim_sweep(struct btrfs_space_info *space_info, int raid)
* If we have any staler groups, we don't touch the fresher ones, but if we
* really need a block group, do take a fresh one.
*/
- if (try_again && urgent) {
- try_again = false;
+ if (!will_reclaim && urgent) {
+ urgent = false;
goto again;
}
--
2.51.2
next prev parent reply other threads:[~2025-12-31 11:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-31 10:39 [PATCH 0/7] btrfs: fix periodic reclaim condition with some cleanup Sun YangKai
2025-12-31 10:39 ` [PATCH 1/7] btrfs: change block group reclaim_mark to bool Sun YangKai
2025-12-31 10:39 ` [PATCH 2/7] btrfs: reorder btrfs_block_group members to reduce struct size Sun YangKai
2025-12-31 10:39 ` [PATCH 3/7] btrfs: use proper types for btrfs_block_group fields Sun YangKai
2025-12-31 10:39 ` [PATCH 4/7] btrfs: consolidate reclaim readiness checks in btrfs_should_reclaim() Sun YangKai
2025-12-31 10:39 ` [PATCH 5/7] btrfs: use u8 for reclaim threshold type Sun YangKai
2025-12-31 10:39 ` Sun YangKai [this message]
2025-12-31 10:39 ` [PATCH 7/7] btrfs: fix periodic reclaim condition Sun YangKai
2026-01-01 0:20 ` Qu Wenruo
2026-01-01 11:44 ` Sun Yangkai
2026-01-01 0:13 ` [PATCH 0/7] btrfs: fix periodic reclaim condition with some cleanup Qu Wenruo
2026-01-01 11:54 ` Sun Yangkai
2026-01-01 21:14 ` Qu Wenruo
2026-01-03 11:17 ` Sun Yangkai
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=20251231111623.30136-7-sunk67188@gmail.com \
--to=sunk67188@gmail.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