• Qu Wenruo's avatar
    btrfs: reduce width for stripe_len from u64 to u32 · cc353a8b
    Qu Wenruo authored
    Currently btrfs uses fixed stripe length (64K), thus u32 is wide enough
    for the usage.
    
    Furthermore, even in the future we choose to enlarge stripe length to
    larger values, I don't believe we would want stripe as large as 4G or
    larger.
    
    So this patch will reduce the width for all in-memory structures and
    parameters, this involves:
    
    - RAID56 related function argument lists
      This allows us to do direct division related to stripe_len.
      Although we will use bits shift to replace the division anyway.
    
    - btrfs_io_geometry structure
      This involves one change to simplify the calculation of both @stripe_nr
      and @stripe_offset, using div64_u64_rem().
      And add extra sanity check to make sure @stripe_offset is always small
      enough for u32.
    
      This saves 8 bytes for the structure.
    
    - map_lookup structure
      This convert @stripe_len to u32, which saves 8 bytes. (saved 4 bytes,
      and removed a 4-bytes hole)
    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>
    cc353a8b
volumes.h 18.1 KB