From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 4/4] btrfs: convert btrfs_block_group::seq_zone to runtime flag
Date: Mon, 31 Oct 2022 20:33:46 +0100 [thread overview]
Message-ID: <0ad1f02fb8e431f6b4ddeef12a0748a69b65a6df.1667244568.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1667244567.git.dsterba@suse.com>
In zoned mode the sequential status of zone can be also tracked in the
runtime flags of block group.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/block-group.h | 5 ++---
fs/btrfs/zoned.c | 7 ++++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/block-group.h b/fs/btrfs/block-group.h
index 4cee23c11938..a02ea76fd6cf 100644
--- a/fs/btrfs/block-group.h
+++ b/fs/btrfs/block-group.h
@@ -57,6 +57,8 @@ enum btrfs_block_group_flags {
BLOCK_GROUP_FLAG_ZONED_DATA_RELOC,
/* Does the block group need to be added to the free space tree? */
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 {
@@ -210,9 +212,6 @@ struct btrfs_block_group {
/* Lock for free space tree operations. */
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.
* All accesses protected by the spinlock 'lock'.
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 32a5aac1cccb..f805e44b11f8 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -1396,7 +1396,7 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new)
}
if (num_sequential > 0)
- cache->seq_zone = true;
+ set_bit(BLOCK_GROUP_FLAG_SEQUENTIAL_ZONE, &cache->runtime_flags);
if (num_conventional > 0) {
/* Zone capacity is always zone size in emulation */
@@ -1608,7 +1608,7 @@ bool btrfs_use_zone_append(struct btrfs_inode *inode, u64 start)
if (!cache)
return false;
- ret = cache->seq_zone;
+ ret = !!test_bit(BLOCK_GROUP_FLAG_SEQUENTIAL_ZONE, &cache->runtime_flags);
btrfs_put_block_group(cache);
return ret;
@@ -2113,7 +2113,8 @@ static void btrfs_zone_finish_endio_workfn(struct work_struct *work)
void btrfs_schedule_zone_finish_bg(struct btrfs_block_group *bg,
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;
if (WARN_ON(bg->zone_finish_work.func == btrfs_zone_finish_endio_workfn)) {
--
2.37.3
next prev parent reply other threads:[~2022-10-31 19:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-31 19:33 [PATCH 0/4] Minor cleanups David Sterba
2022-10-31 19:33 ` [PATCH 1/4] btrfs: zlib: use copy_page for full page copy David Sterba
2022-10-31 23:49 ` Anand Jain
2022-10-31 19:33 ` [PATCH 2/4] btrfs: zoned: use helper to check a power of two zone size David Sterba
2022-10-31 23:49 ` Anand Jain
2022-10-31 19:33 ` [PATCH 3/4] btrfs: convert btrfs_block_group::needs_free_space to runtime flag David Sterba
2022-10-31 23:50 ` Anand Jain
2022-10-31 19:33 ` David Sterba [this message]
2022-10-31 23:50 ` [PATCH 4/4] btrfs: convert btrfs_block_group::seq_zone " Anand Jain
2022-11-03 13:16 ` [PATCH 0/4] Minor cleanups David Sterba
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=0ad1f02fb8e431f6b4ddeef12a0748a69b65a6df.1667244568.git.dsterba@suse.com \
--to=dsterba@suse.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;
as well as URLs for NNTP newsgroup(s).