diff options
| author | Sun YangKai <sunk67188@gmail.com> | 2026-01-14 11:47:03 +0800 |
|---|---|---|
| committer | David Sterba <dsterba@suse.com> | 2026-02-03 07:56:14 +0100 |
| commit | 4b7ecd0984e34262430b9db7efbfaf293b4b4d3c (patch) | |
| tree | 13b168b6f70731faa828ef85aeb959adc2c9376a | |
| parent | 19eff93dc738e8afaa59cb374b44bb5a162e6c2d (diff) | |
btrfs: consolidate reclaim readiness checks in btrfs_should_reclaim()
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>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Sun YangKai <sunk67188@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
| -rw-r--r-- | fs/btrfs/block-group.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 6c6133584196..022c77f8d0e2 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -1822,6 +1822,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; @@ -1856,12 +1862,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; |
