• Qu Wenruo's avatar
    btrfs: Refactor __get_raid_index() to btrfs_bg_flags_to_raid_index() · 3e72ee88
    Qu Wenruo authored
    Function __get_raid_index() is used to convert block group flags into
    raid index, which can be used to get various info directly from
    btrfs_raid_array[].
    
    Refactor this function a little:
    
    1) Rename to btrfs_bg_flags_to_raid_index()
       Double underline prefix is normally for internal functions, while the
       function is used by both extent-tree and volumes.
    
       Although the name is a little longer, but it should explain its usage
       quite well.
    
    2) Move it to volumes.h and make it static inline
       Just several if-else branches, really no need to define it as a normal
       function.
    
       This also makes later code re-use between kernel and btrfs-progs
       easier.
    
    3) Remove function get_block_group_index()
       Really no need to do such a simple thing as an exported function.
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
    Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    3e72ee88
volumes.h 17 KB