mbox series

[0/2] btrfs: zoned: replace active_total_bytes counter

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

Message

Naohiro Aota March 13, 2023, 7:06 a.m. UTC
This series depends on clean up part (patches 1 and 2) of Josef's series.

https://lore.kernel.org/linux-btrfs/cover.1677705092.git.josef@toxicpanda.com/

The naming of space_info->active_total_bytes is misleading. It counts not
only active block groups but also full ones which are previously active but
now inactive. That confusion results in a bug not counting the full BGs
into active_total_bytes on mount time.

Instead, we can count the whole region of a newly allocated block group as
zone_unusable. Then, once that block group is activated, release [0
.. zone_capcity] from the zone_unusable counters. With this, we can
eliminate the confusing ->active_total_bytes and the code will be common
among regular and the zoned mode.

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            | 27 +++++++++++++++++--------
 5 files changed, 35 insertions(+), 48 deletions(-)

Comments

David Sterba March 14, 2023, 6:13 p.m. UTC | #1
On Mon, Mar 13, 2023 at 04:06:12PM +0900, Naohiro Aota wrote:
> This series depends on clean up part (patches 1 and 2) of Josef's series.
> 
> https://lore.kernel.org/linux-btrfs/cover.1677705092.git.josef@toxicpanda.com/
> 
> The naming of space_info->active_total_bytes is misleading. It counts not
> only active block groups but also full ones which are previously active but
> now inactive. That confusion results in a bug not counting the full BGs
> into active_total_bytes on mount time.
> 
> Instead, we can count the whole region of a newly allocated block group as
> zone_unusable. Then, once that block group is activated, release [0
> .. zone_capcity] from the zone_unusable counters. With this, we can
> eliminate the confusing ->active_total_bytes and the code will be common
> among regular and the zoned mode.
> 
> Naohiro Aota (2):
>   btrfs: zoned: count fresh BG region as zone unusable
>   btrfs: zoned: drop space_info->active_total_bytes

Added to misc-next with the two patches from Josef's series, thanks.