Skip to content

Commit

Permalink
Btrfs: fix cluster alignment for mount -o ssd
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chris Mason committed Feb 1, 2013
1 parent 6ac0f48 commit 8de972b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5715,6 +5715,7 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
* lets look there
*/
if (last_ptr) {
unsigned long aligned_cluster;
/*
* the refill lock keeps out other
* people trying to start a new cluster
Expand Down Expand Up @@ -5781,11 +5782,15 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
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
Expand Down

0 comments on commit 8de972b

Please sign in to comment.