• Naohiro Aota's avatar
    btrfs: zoned: avoid chunk allocation if active block group has enough space · a85f05e5
    Naohiro Aota authored
    The current extent allocator tries to allocate a new block group when the
    existing block groups do not have enough space. On a ZNS device, a new
    block group means a new active zone. If the number of active zones has
    already reached the max_active_zones, activating a new zone needs to finish
    an existing zone, leading to wasting the free space there.
    
    So, instead, it should reuse the existing active block groups as much as
    possible when we can't activate any other zones without sacrificing an
    already activated block group.
    
    While at it, I converted find_free_extent_update_loop() to check the
    found_extent() case early and made the other conditions simpler.
    Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    a85f05e5
zoned.c 47.1 KB