aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2010-03-17 16:45:56 -0400
committerChris Mason <chris.mason@oracle.com>2010-03-30 21:19:09 -0400
commit0cad8a1130f77c7c445e3298c0e3593b3c0ef439 (patch)
tree1f045f7baccc9dd2c1ac805b94cdedc4bbab618f /fs/btrfs
parent287a0ab91d25ca982f895a76402e5893b47ed7a6 (diff)
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: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/volumes.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index bf3bec3e4130..9bf1f581b872 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2244,8 +2244,10 @@ again:
2244 do_div(calc_size, stripe_len); 2244 do_div(calc_size, stripe_len);
2245 calc_size *= stripe_len; 2245 calc_size *= stripe_len;
2246 } 2246 }
2247
2247 /* we don't want tiny stripes */ 2248 /* we don't want tiny stripes */
2248 calc_size = max_t(u64, min_stripe_size, calc_size); 2249 if (!looped)
2250 calc_size = max_t(u64, min_stripe_size, calc_size);
2249 2251
2250 do_div(calc_size, stripe_len); 2252 do_div(calc_size, stripe_len);
2251 calc_size *= stripe_len; 2253 calc_size *= stripe_len;