Commit 0cad8a11 authored by Josef Bacik's avatar Josef Bacik Committed by Chris Mason

Btrfs: fix chunk allocate size calculation

If the amount of free space left in a device is less than what we think should
be the minimum size, just ignore the minimum size and use the amount we have.  I
ran into this running tests on a 600mb volume, the chunk allocator wouldn't let
me allocate the last 52mb of the disk for data because we want to have at least
64mb chunks for data.  This patch fixes that problem.  Thanks,
Signed-off-by: default avatarJosef Bacik <josef@redhat.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 287a0ab9
...@@ -2244,7 +2244,9 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, ...@@ -2244,7 +2244,9 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
do_div(calc_size, stripe_len); do_div(calc_size, stripe_len);
calc_size *= stripe_len; calc_size *= stripe_len;
} }
/* we don't want tiny stripes */ /* we don't want tiny stripes */
if (!looped)
calc_size = max_t(u64, min_stripe_size, calc_size); calc_size = max_t(u64, min_stripe_size, calc_size);
do_div(calc_size, stripe_len); do_div(calc_size, stripe_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment