diff options
-rw-r--r-- | fs/btrfs/volumes.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 759d02486d7c..ce289af526f0 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -3324,12 +3324,14 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | |||
3324 | stripe_size = devices_info[ndevs-1].max_avail; | 3324 | stripe_size = devices_info[ndevs-1].max_avail; |
3325 | num_stripes = ndevs * dev_stripes; | 3325 | num_stripes = ndevs * dev_stripes; |
3326 | 3326 | ||
3327 | if (stripe_size * num_stripes > max_chunk_size * ncopies) { | 3327 | if (stripe_size * ndevs > max_chunk_size * ncopies) { |
3328 | stripe_size = max_chunk_size * ncopies; | 3328 | stripe_size = max_chunk_size * ncopies; |
3329 | do_div(stripe_size, num_stripes); | 3329 | do_div(stripe_size, ndevs); |
3330 | } | 3330 | } |
3331 | 3331 | ||
3332 | do_div(stripe_size, dev_stripes); | 3332 | do_div(stripe_size, dev_stripes); |
3333 | |||
3334 | /* align to BTRFS_STRIPE_LEN */ | ||
3333 | do_div(stripe_size, BTRFS_STRIPE_LEN); | 3335 | do_div(stripe_size, BTRFS_STRIPE_LEN); |
3334 | stripe_size *= BTRFS_STRIPE_LEN; | 3336 | stripe_size *= BTRFS_STRIPE_LEN; |
3335 | 3337 | ||