• Qu Wenruo's avatar
    btrfs: warn on tree blocks which are not nodesize aligned · 6d3a6194
    Qu Wenruo authored
    
    
    A long time ago, we had some metadata chunks which started at sector
    boundary but not aligned to nodesize boundary.
    
    This led to some older filesystems which can have tree blocks only
    aligned to sectorsize, but not nodesize.
    
    Later 'btrfs check' gained the ability to detect and warn about such tree
    blocks, and kernel fixed the chunk allocation behavior, nowadays those
    tree blocks should be pretty rare.
    
    But in the future, if we want to migrate metadata to folio, we cannot
    have such tree blocks, as filemap_add_folio() requires the page index to
    be aligned with the folio number of pages.  Such unaligned tree blocks
    can lead to VM_BUG_ON().
    
    So this patch adds extra warning for those unaligned tree blocks, as a
    preparation for the future folio migration.
    Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    6d3a6194
extent_io.c 128 KB