mbox series

[0/8] btrfs: zoned: write-time activation of metadata block group

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

Message

Naohiro Aota July 24, 2023, 4:18 a.m. UTC
In the current implementation, block groups are activated at
reservation time to ensure that all reserved bytes can be written to
an active metadata block group. However, this approach has proven to
be less efficient, as it activates block groups more frequently than
necessary, putting pressure on the active zone resource and leading to
potential issues such as early ENOSPC or hung_task.

Another drawback of the current method is that it hampers metadata
over-commit, and necessitates additional flush operations and block
group allocations, resulting in decreased overall performance.

Actually, we don't need so many active metadata block groups because
there is only one sequential metadata write stream.

So, this series introduces a write-time activation of metadata and
system block group. This involves reserving at least one active block
group specifically for a metadata and system block group. When the
write goes into a new block group, it should have allocated all the
regions in the current active block group. So, we can wait for IOs to
fill the space, and then switch to a new block group.

Switching to the write-time activation solves the above issue and will
lead to better performance.

* Organization

Patches 1-3 are preparation patches involves meta_write_pointer check.

Patches 4 and 5 are the main part of this series, implementing the
write-time activation.

Patches 6-8 addresses code for reserve time activation: counting fresh
block group as zone_unusable, activating a block group on allocation,
and disabling metadata over-commit.

Naohiro Aota (8):
  btrfs: zoned: introduce block_group context for submit_eb_page()
  btrfs: zoned: defer advancing meta_write_pointer
  btrfs: zoned: update meta_write_pointer on zone finish
  btrfs: zoned: reserve zones for an active metadata/system block group
  btrfs: zoned: activate metadata block group on write time
  btrfs: zoned: no longer count fresh BG region as zone unusable
  btrfs: zoned: don't activate non-DATA BG on allocation
  btrfs: zoned: re-enable metadata over-commit for zoned mode

 fs/btrfs/block-group.c      |  13 ++-
 fs/btrfs/extent-tree.c      |   8 +-
 fs/btrfs/extent_io.c        |  28 +++---
 fs/btrfs/free-space-cache.c |   8 +-
 fs/btrfs/fs.h               |   3 +
 fs/btrfs/space-info.c       |  34 +------
 fs/btrfs/zoned.c            | 187 +++++++++++++++++++++++++++---------
 fs/btrfs/zoned.h            |   9 +-
 8 files changed, 181 insertions(+), 109 deletions(-)