• Qu Wenruo's avatar
    btrfs: make validate_extent_map() catch ram_bytes mismatch · 1b87d26a
    Qu Wenruo authored
    Previously validate_extent_map() is only to catch bugs related to
    extent_map member cleanups.
    
    But with recent btrfs-check enhancement to catch ram_bytes mismatch with
    disk_num_bytes, it would be much better to catch such extent maps
    earlier.
    
    So this patch adds extra ram_bytes validation for extent maps.
    
    Please note that, older filesystems with such mismatch won't trigger this error:
    
    - extent_map::ram_bytes is already fixed
      Previous patch has already fixed the ram_bytes for affected file
      extents.
    
    So this enhanced sanity check should not affect end users.
    Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    1b87d26a
extent_map.c 35.9 KB