[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <032b0938-88fe-4129-8e49-6d4634ea1844@kernel.org>
Date: Fri, 29 Mar 2024 08:06:31 +0900
From: Damien Le Moal <dlemoal@...nel.org>
To: Johannes Thumshirn <jth@...nel.org>, Chris Mason <clm@...com>,
Josef Bacik <josef@...icpanda.com>, David Sterba <dsterba@...e.com>
Cc: linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
Hans Holmberg <Hans.Holmberg@....com>, Naohiro Aota <Naohiro.Aota@....com>,
hch@....de, Boris Burkov <boris@....io>,
Johannes Thumshirn <johannes.thumshirn@....com>
Subject: Re: [PATCH RFC PATCH 3/3] btrfs: zoned: kick cleaner kthread if low
on space
On 3/28/24 22:56, Johannes Thumshirn wrote:
> From: Johannes Thumshirn <johannes.thumshirn@....com>
>
> Kick the cleaner kthread on chunk allocation if we're slowly running out
> of usable space on a zoned filesystem.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@....com>
> ---
> fs/btrfs/zoned.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
> index fb8707f4cab5..25c1a17873db 100644
> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -1040,6 +1040,7 @@ int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror)
> u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start,
> u64 hole_end, u64 num_bytes)
> {
> + struct btrfs_fs_info *fs_info = device->fs_info;
> struct btrfs_zoned_device_info *zinfo = device->zone_info;
> const u8 shift = zinfo->zone_size_shift;
> u64 nzones = num_bytes >> shift;
> @@ -1051,6 +1052,11 @@ u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start,
> ASSERT(IS_ALIGNED(hole_start, zinfo->zone_size));
> ASSERT(IS_ALIGNED(num_bytes, zinfo->zone_size));
>
> + if (!test_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags) &&
> + btrfs_zoned_should_reclaim(fs_info)) {
> + wake_up_process(fs_info->cleaner_kthread);
> + }
Nit: no need for the curly brackets.
> +
> while (pos < hole_end) {
> begin = pos >> shift;
> end = begin + nzones;
>
--
Damien Le Moal
Western Digital Research
Powered by blists - more mailing lists