Skip to content

Commit

Permalink
Btrfs: fix chunk allocate size calculation
Browse files Browse the repository at this point in the history
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: Josef Bacik <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
Josef Bacik authored and chrismason-xx committed Mar 31, 2010
1 parent 287a0ab commit 0cad8a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2244,8 +2244,10 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans,
do_div(calc_size, stripe_len);
calc_size *= stripe_len;
}

/* we don't want tiny stripes */
calc_size = max_t(u64, min_stripe_size, calc_size);
if (!looped)
calc_size = max_t(u64, min_stripe_size, calc_size);

do_div(calc_size, stripe_len);
calc_size *= stripe_len;
Expand Down

0 comments on commit 0cad8a1

Please sign in to comment.