]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Btrfs: make sure the chunk allocator doesn't create zero length chunks
authorChris Mason <chris.mason@oracle.com>
Tue, 6 Apr 2010 13:37:47 +0000 (09:37 -0400)
committerChris Mason <chris.mason@oracle.com>
Tue, 6 Apr 2010 13:37:47 +0000 (09:37 -0400)
A recent commit allowed for smaller chunks to be created, but didn't
make sure they were always bigger than a stripe.  After some divides,
this led to zero length stripes.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/volumes.c

index 9bf1f581b8728d2779c03fc6af0bc73b3ad98fce..b584e9a2add29034dca25e79080b10845499cb78 100644 (file)
@@ -2249,6 +2249,12 @@ again:
        if (!looped)
                calc_size = max_t(u64, min_stripe_size, calc_size);
 
+       /*
+        * we're about to do_div by the stripe_len so lets make sure
+        * we end up with something bigger than a stripe
+        */
+       calc_size = max_t(u64, calc_size, stripe_len * 4);
+
        do_div(calc_size, stripe_len);
        calc_size *= stripe_len;