Re: [PATCH 2/6] btrfs: zoned: add a dedicated data relocation block group
From: David Sterba <hidden>
Date: 2021-09-07 11:52:17
From: David Sterba <hidden>
Date: 2021-09-07 11:52:17
On Fri, Sep 03, 2021 at 11:44:43PM +0900, Johannes Thumshirn wrote:
index 8cc0b29e24ee..344ba70315d8 100644--- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h@@ -1017,6 +1017,8 @@ struct btrfs_fs_info { struct mutex zoned_meta_io_lock; spinlock_t treelog_bg_lock; u64 treelog_bg; + spinlock_t relocation_bg_lock; + u64 data_reloc_bg;
Please add some comments for the new members.
--- a/fs/btrfs/zoned.h +++ b/fs/btrfs/zoned.h@@ -347,4 +347,13 @@ static inline void btrfs_clear_treelog_bg(struct btrfs_block_group *bg) spin_unlock(&fs_info->treelog_bg_lock); } +static inline void btrfs_clear_data_reloc_bg(struct btrfs_block_group *bg) +{ + struct btrfs_fs_info *fs_info = bg->fs_info; + + spin_lock(&fs_info->relocation_bg_lock); + if (fs_info->data_reloc_bg == bg->start) + fs_info->data_reloc_bg = 0; + spin_unlock(&fs_info->relocation_bg_lock); +}
This does not look like it's important enough to be static inline.