]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Btrfs: fix cluster alignment for mount -o ssd
authorChris Mason <chris.mason@fusionio.com>
Fri, 4 Jan 2013 20:39:43 +0000 (15:39 -0500)
committerChris Mason <chris.mason@fusionio.com>
Fri, 1 Feb 2013 19:24:24 +0000 (14:24 -0500)
With the new raid56 code, we want to make sure we're
properly aligning our allocation clusters with -o ssd

Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/extent-tree.c

index 3345f68fc64b658fc7f928054badf32ce30c8a85..f13402104c96ed268dd4d0c748e55c1ec0df12f1 100644 (file)
@@ -5715,6 +5715,7 @@ have_block_group:
                 * lets look there
                 */
                if (last_ptr) {
+                       unsigned long aligned_cluster;
                        /*
                         * the refill lock keeps out other
                         * people trying to start a new cluster
@@ -5781,11 +5782,15 @@ refill_cluster:
                                goto unclustered_alloc;
                        }
 
+                       aligned_cluster = max_t(unsigned long,
+                                               empty_cluster + empty_size,
+                                             block_group->full_stripe_len);
+
                        /* allocate a cluster in this block group */
                        ret = btrfs_find_space_cluster(trans, root,
                                               block_group, last_ptr,
                                               search_start, num_bytes,
-                                              empty_cluster + empty_size);
+                                              aligned_cluster);
                        if (ret == 0) {
                                /*
                                 * now pull our allocation out of this