From: Naohiro Aota <Naohiro.Aota@wdc.com>
To: Josef Bacik <josef@toxicpanda.com>, Naohiro Aota <Naohiro.Aota@wdc.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH v3 09/13] btrfs: introduce tree-log sub-space_info
Date: Fri, 18 Apr 2025 01:08:25 +0000 [thread overview]
Message-ID: <D99D2QQFZE1O.1K4P59O7DD6LE@wdc.com> (raw)
In-Reply-To: <20250417124437.GD3574107@perftesting>
On Thu Apr 17, 2025 at 9:44 PM JST, Josef Bacik wrote:
> On Wed, Apr 16, 2025 at 11:28:14PM +0900, Naohiro Aota wrote:
>> This commit introduces the tree-log sub-space_info, which is sub-space of
>> metadata space_info and dedicated for tree-log node allocation.
>>
>> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
>> ---
>> fs/btrfs/space-info.c | 4 ++++
>> fs/btrfs/space-info.h | 1 +
>> fs/btrfs/sysfs.c | 10 +++++++++-
>> 3 files changed, 14 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
>> index 37e55298c082..4b2343a3a009 100644
>> --- a/fs/btrfs/space-info.c
>> +++ b/fs/btrfs/space-info.c
>> @@ -292,6 +292,10 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags)
>> if (flags & BTRFS_BLOCK_GROUP_DATA)
>> ret = create_space_info_sub_group(space_info, flags,
>> SUB_GROUP_DATA_RELOC);
>> + else if (flags & BTRFS_BLOCK_GROUP_METADATA)
>> + ret = create_space_info_sub_group(space_info, flags,
>> + SUB_GROUP_METADATA_TREELOG);
>> +
>> if (ret == -ENOMEM)
>> return ret;
>> ASSERT(!ret);
>> diff --git a/fs/btrfs/space-info.h b/fs/btrfs/space-info.h
>> index 64641885babd..1aadf88e5789 100644
>> --- a/fs/btrfs/space-info.h
>> +++ b/fs/btrfs/space-info.h
>> @@ -100,6 +100,7 @@ enum btrfs_flush_state {
>>
>> enum btrfs_space_info_sub_group {
>> SUB_GROUP_DATA_RELOC = 0,
>> + SUB_GROUP_METADATA_TREELOG = 0,
>
> This will mess up since they have the same value now. Thanks,
They intensionally have the same value. Since SUB_GROUP_DATA_RELOC and
SUB_GROUP_METADATA_TREELOG are used to index space_info->sub_group array
and they are in the different root space_info (DATA vs METADATA), they
can have the same value.
But, yeah, making them as an ID would be more clean. So, I'm going to
make the values distinct and introduce a small inline function like
this.
static inline struct btrfs_space_info *btrfs_space_info_sub_group(struct btrfs_space_info *space_info,
enum btrfs_space_info_sub_group subgroup_id)
{
if (subgroup_id == BTRFS_SUB_GROUP_PRIMARY)
return space_info;
if (space_info->flags & BTRFS_BLOCK_GROUP_DATA) {
ASSERT(subgroup_id == BTRFS_SUB_GROUP_DATA_RELOC);
return space_info->sub_group[0];
} else if (space_info->flags & BTRFS_BLOCK_GROUP_METADATA) {
ASSERT(subgroup_id == BTRFS_SUB_GROUP_METADATA_TREELOG);
return space_info->sub_group[0];
}
/* Invalid combination */
ASSERT(0);
return NULL;
}
>
> Josef
next prev parent reply other threads:[~2025-04-18 1:08 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 14:28 [PATCH v3 00/13] btrfs: zoned: split out space_info for dedicated block groups Naohiro Aota
2025-04-16 14:28 ` [PATCH v3 01/13] btrfs: take btrfs_space_info in btrfs_reserve_data_bytes Naohiro Aota
2025-04-16 14:28 ` [PATCH v3 02/13] btrfs: take struct btrfs_inode in btrfs_free_reserved_data_space_noquota Naohiro Aota
2025-04-16 14:28 ` [PATCH v3 03/13] btrfs: factor out init_space_info() Naohiro Aota
2025-04-16 14:28 ` [PATCH v3 04/13] btrfs: spin out do_async_reclaim_{data,metadata}_space() Naohiro Aota
2025-04-16 14:28 ` [PATCH v3 05/13] btrfs: factor out check_removing_space_info() Naohiro Aota
2025-04-16 14:28 ` [PATCH v3 06/13] btrfs: introduce space_info argument to btrfs_chunk_alloc Naohiro Aota
2025-04-17 12:38 ` Josef Bacik
2025-04-18 0:59 ` Naohiro Aota
2025-04-16 14:28 ` [PATCH v3 07/13] btrfs: pass space_info for block group creation Naohiro Aota
2025-04-17 12:40 ` Josef Bacik
2025-04-16 14:28 ` [PATCH v3 08/13] btrfs: introduce btrfs_space_info sub-group Naohiro Aota
2025-04-16 14:56 ` Johannes Thumshirn
2025-04-17 12:43 ` Josef Bacik
2025-04-16 14:28 ` [PATCH v3 09/13] btrfs: introduce tree-log sub-space_info Naohiro Aota
2025-04-16 14:57 ` Johannes Thumshirn
2025-04-17 12:44 ` Josef Bacik
2025-04-18 1:08 ` Naohiro Aota [this message]
2025-04-16 14:28 ` [PATCH v3 10/13] btrfs: tweak extent/chunk allocation for space_info sub-space Naohiro Aota
2025-04-17 5:48 ` Naohiro Aota
2025-04-16 14:28 ` [PATCH v3 11/13] btrfs: use proper data space_info Naohiro Aota
2025-04-16 14:59 ` Johannes Thumshirn
2025-04-17 4:35 ` Naohiro Aota
2025-04-16 14:28 ` [PATCH v3 12/13] btrfs: add block_rsv for treelog Naohiro Aota
2025-04-17 12:48 ` Josef Bacik
2025-04-16 14:28 ` [PATCH v3 13/13] btrfs: reclaim from sub-space space_info Naohiro Aota
2025-04-17 12:49 ` Josef Bacik
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=D99D2QQFZE1O.1K4P59O7DD6LE@wdc.com \
--to=naohiro.aota@wdc.com \
--cc=josef@toxicpanda.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