• Naohiro Aota's avatar
    btrfs: zoned: activate metadata block group on write time · 13bb483d
    Naohiro Aota authored
    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.
    
    To address these issues, this commit 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.
    
    Since metadata write-out is always allocated sequentially, when we need to
    write to a non-active block group, we can wait for the ongoing IOs to
    complete, activate a new block group, and then proceed with writing to the
    new block group.
    
    Fixes: b0931513 ("btrfs: zoned: activate metadata block group on flush_space")
    CC: stable@vger.kernel.org # 6.1+
    Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    13bb483d
fs.h 28.7 KB