• Qu Wenruo's avatar
    btrfs: make btrfs_super_block size match BTRFS_SUPER_INFO_SIZE · 38732474
    Qu Wenruo authored
    It's a common practice to avoid use sizeof(struct btrfs_super_block)
    (3531), but to use BTRFS_SUPER_INFO_SIZE (4096).
    
    The problem is that, sizeof(struct btrfs_super_block) doesn't match
    BTRFS_SUPER_INFO_SIZE from the very beginning.
    
    Furthermore, for all call sites except selftests, we always allocate
    BTRFS_SUPER_INFO_SIZE space for super block, there isn't any real reason
    to use the smaller value, and it doesn't really save any space.
    
    So let's get rid of such confusing behavior, and unify those two values.
    
    This modification also adds a new static_assert() to verify the size,
    and moves the BTRFS_SUPER_INFO_* macros to the definition of
    btrfs_super_block for the static_assert().
    Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.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>
    38732474
ctree.h 131 KB