diff mbox series

[3/8] btrfs: zoned: update meta_write_pointer on zone finish

Message ID 61507f174fbd62e792667bec3defed99633605bd.1690171333.git.naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs: zoned: write-time activation of metadata block group | expand

Commit Message

Naohiro Aota July 24, 2023, 4:18 a.m. UTC
On finishing a zone, the meta_write_pointer should be set of the end of the
zone to reflect the actual write pointer position.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/zoned.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Christoph Hellwig July 24, 2023, 3:04 p.m. UTC | #1
On Mon, Jul 24, 2023 at 01:18:32PM +0900, Naohiro Aota wrote:
> On finishing a zone, the meta_write_pointer should be set of the end of the
> zone to reflect the actual write pointer position.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Does this need a Fixes a tag?
Naohiro Aota July 25, 2023, 9:01 a.m. UTC | #2
On Mon, Jul 24, 2023 at 08:04:54AM -0700, Christoph Hellwig wrote:
> On Mon, Jul 24, 2023 at 01:18:32PM +0900, Naohiro Aota wrote:
> > On finishing a zone, the meta_write_pointer should be set of the end of the
> > zone to reflect the actual write pointer position.
> 
> Looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> Does this need a Fixes a tag?

I don't think so, because there is no actual bug hit by this as far as I
know.
diff mbox series

Patch

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index 3f8f5e8c28a9..dd86f1858c88 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -2048,6 +2048,9 @@  static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
 
 	clear_bit(BLOCK_GROUP_FLAG_ZONE_IS_ACTIVE, &block_group->runtime_flags);
 	block_group->alloc_offset = block_group->zone_capacity;
+	if (block_group->flags & (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM))
+		block_group->meta_write_pointer = block_group->start +
+			block_group->zone_capacity;
 	block_group->free_space_ctl->free_space = 0;
 	btrfs_clear_treelog_bg(block_group);
 	btrfs_clear_data_reloc_bg(block_group);