From: Boris Burkov <boris@bur.io>
To: Sun YangKai <sunk67188@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 2/2] btrfs: consolidate reclaim readiness checks in btrfs_should_reclaim()
Date: Tue, 13 Jan 2026 10:32:38 -0800 [thread overview]
Message-ID: <20260113183238.GE972704@zen.localdomain> (raw)
In-Reply-To: <20260113060935.21814-4-sunk67188@gmail.com>
On Tue, Jan 13, 2026 at 12:07:05PM +0800, Sun YangKai wrote:
> Move the filesystem state validation from btrfs_reclaim_bgs_work() into
> btrfs_should_reclaim() to centralize the reclaim eligibility logic.
> Since it is the only caller of btrfs_should_reclaim(), there's no
> functional change.
>
Reviewed-by: Boris Burkov <boris@bur.io>
> Signed-off-by: Sun YangKai <sunk67188@gmail.com>
> ---
> fs/btrfs/block-group.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
> index f0945a799aed..9ca4db7eebfb 100644
> --- a/fs/btrfs/block-group.c
> +++ b/fs/btrfs/block-group.c
> @@ -1804,6 +1804,12 @@ static int reclaim_bgs_cmp(void *unused, const struct list_head *a,
>
> static inline bool btrfs_should_reclaim(const struct btrfs_fs_info *fs_info)
> {
> + if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
> + return false;
> +
> + if (btrfs_fs_closing(fs_info))
> + return false;
> +
> if (btrfs_is_zoned(fs_info))
> return btrfs_zoned_should_reclaim(fs_info);
> return true;
> @@ -1838,12 +1844,6 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)
> struct btrfs_space_info *space_info;
> LIST_HEAD(retry_list);
>
> - if (!test_bit(BTRFS_FS_OPEN, &fs_info->flags))
> - return;
> -
> - if (btrfs_fs_closing(fs_info))
> - return;
> -
> if (!btrfs_should_reclaim(fs_info))
> return;
>
> --
> 2.52.0
>
prev parent reply other threads:[~2026-01-13 18:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 4:07 [PATCH v3 0/2] btrfs: fix periodic reclaim condition Sun YangKai
2026-01-13 4:07 ` [PATCH v3 1/2] " Sun YangKai
2026-01-13 18:32 ` Boris Burkov
2026-01-14 3:44 ` Sun Yangkai
2026-01-13 4:07 ` [PATCH v3 2/2] btrfs: consolidate reclaim readiness checks in btrfs_should_reclaim() Sun YangKai
2026-01-13 18:32 ` Boris Burkov [this message]
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=20260113183238.GE972704@zen.localdomain \
--to=boris@bur.io \
--cc=linux-btrfs@vger.kernel.org \
--cc=sunk67188@gmail.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