Commit 961f5b8b authored by David Sterba's avatar David Sterba

btrfs: convert btrfs_block_group::seq_zone to runtime flag

In zoned mode the sequential status of zone can be also tracked in the
runtime flags of block group.
Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 0d7764ff
...@@ -57,6 +57,8 @@ enum btrfs_block_group_flags { ...@@ -57,6 +57,8 @@ enum btrfs_block_group_flags {
BLOCK_GROUP_FLAG_ZONED_DATA_RELOC, BLOCK_GROUP_FLAG_ZONED_DATA_RELOC,
/* Does the block group need to be added to the free space tree? */ /* Does the block group need to be added to the free space tree? */
BLOCK_GROUP_FLAG_NEEDS_FREE_SPACE, BLOCK_GROUP_FLAG_NEEDS_FREE_SPACE,
/* Indicate that the block group is placed on a sequential zone */
BLOCK_GROUP_FLAG_SEQUENTIAL_ZONE,
}; };
enum btrfs_caching_type { enum btrfs_caching_type {
...@@ -210,9 +212,6 @@ struct btrfs_block_group { ...@@ -210,9 +212,6 @@ struct btrfs_block_group {
/* Lock for free space tree operations. */ /* Lock for free space tree operations. */
struct mutex free_space_lock; struct mutex free_space_lock;
/* Flag indicating this block group is placed on a sequential zone */
bool seq_zone;
/* /*
* Number of extents in this block group used for swap files. * Number of extents in this block group used for swap files.
* All accesses protected by the spinlock 'lock'. * All accesses protected by the spinlock 'lock'.
......
...@@ -1437,7 +1437,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new) ...@@ -1437,7 +1437,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new)
} }
if (num_sequential > 0) if (num_sequential > 0)
cache->seq_zone = true; set_bit(BLOCK_GROUP_FLAG_SEQUENTIAL_ZONE, &cache->runtime_flags);
if (num_conventional > 0) { if (num_conventional > 0) {
/* Zone capacity is always zone size in emulation */ /* Zone capacity is always zone size in emulation */
...@@ -1649,7 +1649,7 @@ bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start) ...@@ -1649,7 +1649,7 @@ bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start)
if (!cache) if (!cache)
return false; return false;
ret = cache->seq_zone; ret = !!test_bit(BLOCK_GROUP_FLAG_SEQUENTIAL_ZONE, &cache->runtime_flags);
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
return ret; return ret;
...@@ -2154,7 +2154,8 @@ static void btrfs_zone_finish_endio_workfn(struct work_struct *work) ...@@ -2154,7 +2154,8 @@ static void btrfs_zone_finish_endio_workfn(struct work_struct *work)
void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg, void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg,
struct extent_buffer *eb) struct extent_buffer *eb)
{ {
if (!bg->seq_zone || eb->start + eb->len * 2 <= bg->start + bg->zone_capacity) if (!test_bit(BLOCK_GROUP_FLAG_SEQUENTIAL_ZONE, &bg->runtime_flags) ||
eb->start + eb->len * 2 <= bg->start + bg->zone_capacity)
return; return;
if (WARN_ON(bg->zone_finish_work.func == btrfs_zone_finish_endio_workfn)) { if (WARN_ON(bg->zone_finish_work.func == btrfs_zone_finish_endio_workfn)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment