ext4: do not use stripe_width if it is not set
authorJan Kara <jack@suse.cz>
Fri, 10 Feb 2017 05:56:09 +0000 (00:56 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 10 Feb 2017 05:56:09 +0000 (00:56 -0500)
Avoid using stripe_width for sbi->s_stripe value if it is not actually
set. It prevents using the stride for sbi->s_stripe.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c

index 3db5b6491513db23fd157374de31a0b07c089476..dde14a7ac6d77958ae8b1c55ccbdd3d46804bd6d 100644 (file)
@@ -2637,9 +2637,9 @@ static unsigned long ext4_get_stripe_size(struct ext4_sb_info *sbi)
 
        if (sbi->s_stripe && sbi->s_stripe <= sbi->s_blocks_per_group)
                ret = sbi->s_stripe;
-       else if (stripe_width <= sbi->s_blocks_per_group)
+       else if (stripe_width && stripe_width <= sbi->s_blocks_per_group)
                ret = stripe_width;
-       else if (stride <= sbi->s_blocks_per_group)
+       else if (stride && stride <= sbi->s_blocks_per_group)
                ret = stride;
        else
                ret = 0;