Btrfs: fix cluster alignment for mount -o ssd

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>
This commit is contained in:
Chris Mason 2013-01-04 15:39:43 -05:00
parent 6ac0f4884e
commit 8de972b4fa

View file

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