• Qu Wenruo's avatar
    btrfs: tree-checker: Add EXTENT_ITEM and METADATA_ITEM check · f82d1c7c
    Qu Wenruo authored
    This patch introduces the ability to check extent items.
    
    This check involves:
    - key->objectid check
      Basic alignment check.
    
    - key->type check
      Against btrfs_extent_item::type and SKINNY_METADATA feature.
    
    - key->offset alignment check for EXTENT_ITEM
    
    - key->offset check for METADATA_ITEM
    
    - item size check
      Both against minimal size and stepping check.
    
    - btrfs_extent_item check
      Checks its flags and generation.
    
    - btrfs_extent_inline_ref checks
      Against 4 types inline ref.
      Checks bytenr alignment and tree level.
    
    - btrfs_extent_item::refs check
      Check against total refs found in inline refs.
    
    This check would be the most complex single item check due to its nature
    of inlined items.
    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>
    f82d1c7c
tree-checker.c 40.9 KB