mbox series

[RFC,0/2] btrfs: zoned: replace active_total_bytes system

Message ID cover.1677831912.git.naohiro.aota@wdc.com (mailing list archive)
Headers show
Series btrfs: zoned: replace active_total_bytes system | expand

Message

Naohiro Aota March 3, 2023, 8:26 a.m. UTC
This series is still not well tested. Please don't merge right now.

The space_info->active_total_bytes is misleading. It counts not only active
block groups but also previously active but now inactive (full BGs, due to
fully written) ones. That results in a bug not counting the full BGs into
active_total_bytes.

Instead, we can count a newly allocated block group's region as
zone_unusable. Then, once that block group is activated, subtract [0
.. zone_capcity] from the zone_unusable counters. With this, the regualr
space_info's accounting code will align naturally for zone activation
support.

Naohiro Aota (2):
  btrfs: zoned: count fresh BG region as zone unusable
  btrfs: zoned: drop space_info->active_total_bytes

 fs/btrfs/block-group.c      |  6 ------
 fs/btrfs/free-space-cache.c |  8 +++++++-
 fs/btrfs/space-info.c       | 40 +++++++++----------------------------
 fs/btrfs/space-info.h       |  2 --
 fs/btrfs/zoned.c            | 26 ++++++++++++++++--------
 5 files changed, 34 insertions(+), 48 deletions(-)