• Qu Wenruo's avatar
    btrfs: volumes: Remove the meaningless condition of minimal nr_devs when allocating a chunk · ba89b802
    Qu Wenruo authored
    When checking the minimal nr_devs, there is one dead and meaningless
    condition:
    
    if (ndevs < devs_increment * sub_stripes || ndevs < devs_min) {
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    
    This condition is meaningless, @devs_increment has nothing to do with
    @sub_stripes.
    
    In fact, in btrfs_raid_array[], profile with sub_stripes larger than 1
    (RAID10) already has the @devs_increment set to 2.
    So no need to multiple it by @sub_stripes.
    
    And above condition is also dead.
    For RAID10, @devs_increment * @sub_stripes equals 4, which is also the
    @devs_min of RAID10.
    For other profiles, @sub_stripes is always 1, and since @ndevs is
    rounded down to @devs_increment, the condition will always be true.
    
    Remove the meaningless condition to make later reader wander less.
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarNikolay Borisov <nborisov@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    ba89b802
volumes.c 194 KB