[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <122b5973-0191-44aa-b3e2-bdae52ce1f36@wdc.com>
Date: Wed, 22 May 2024 08:31:00 +0000
From: Johannes Thumshirn <Johannes.Thumshirn@....com>
To: Filipe Manana <fdmanana@...nel.org>, Johannes Thumshirn <jth@...nel.org>
CC: Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>, David Sterba
<dsterba@...e.com>, Hans Holmberg <Hans.Holmberg@....com>,
"linux-btrfs@...r.kernel.org" <linux-btrfs@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Naohiro Aota
<Naohiro.Aota@....com>
Subject: Re: [PATCH v3 1/2] btrfs: zoned: reserve relocation block-group on
mount
On 21.05.24 17:23, Filipe Manana wrote:
>> +static u64 find_empty_block_group(struct btrfs_space_info *sinfo, u64 flags)
>> +{
>> + struct btrfs_block_group *bg;
>> +
>> + for (int i = 0; i < BTRFS_NR_RAID_TYPES; i++) {
>> + list_for_each_entry(bg, &sinfo->block_groups[i], list) {
>> + if (bg->flags != flags)
>> + continue;
>> + if (bg->used == 0)
>> + return bg->start;
>> + }
>> + }
> I believe I commented about this in some previous patchset version,
> but here goes again.
>
> This happens at mount time, where we have already loaded all block groups.
> When we load them, if we find unused ones, we add them to the list of
> empty block groups, so that the next time the cleaner kthread runs it
> deletes them.
>
> I don't see any code here removing the selected block group from that
> list, or anything at btrfs_delete_unused_bgs() that prevents deleting
> a block group if it was selected as the data reloc bg.
>
> Maybe I'm missing something?
> How do ensure the selected block group isn't deleted by the cleaner kthread?
Indeed, I forgot about that.
Powered by blists - more mailing lists