• Naohiro Aota's avatar
    btrfs: zoned: reserve zones for an active metadata/system block group · a7e1ac7b
    Naohiro Aota authored
    Ensure a metadata and system block group can be activated on write time, by
    leaving a certain number of active zones when trying to activate a data
    block group.
    
    Zones for two metadata block groups (normal and tree-log) and one system
    block group are reserved, according to the profile type: two zones per
    block group on the DUP profile and one zone per block group otherwise.
    
    The reservation must be freed once a non-data block group is allocated. If
    not, we over-reserve the active zones and data block group activation will
    suffer. For the dynamic reservation count, we need to manage the
    reservation count per device.
    
    The reservation count variable is protected by
    fs_info->zone_active_bgs_lock.
    Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    a7e1ac7b
zoned.h 11.3 KB