diff options
author | Chris Mason <chris.mason@fusionio.com> | 2013-01-04 15:39:43 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-01 14:24:24 -0500 |
commit | 8de972b4faa4be9b2a3c53103e18d86092a5da45 (patch) | |
tree | c81436a4a777362f27d6982d8eed904c4131ba40 /fs/btrfs/extent-tree.c | |
parent | 6ac0f4884eaad28441c6e0f9d1400a08c2149049 (diff) |
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>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
-rw-r--r-- | fs/btrfs/extent-tree.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3345f68fc64b..f13402104c96 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5715,6 +5715,7 @@ have_block_group: | |||
5715 | * lets look there | 5715 | * lets look there |
5716 | */ | 5716 | */ |
5717 | if (last_ptr) { | 5717 | if (last_ptr) { |
5718 | unsigned long aligned_cluster; | ||
5718 | /* | 5719 | /* |
5719 | * the refill lock keeps out other | 5720 | * the refill lock keeps out other |
5720 | * people trying to start a new cluster | 5721 | * people trying to start a new cluster |
@@ -5781,11 +5782,15 @@ refill_cluster: | |||
5781 | goto unclustered_alloc; | 5782 | goto unclustered_alloc; |
5782 | } | 5783 | } |
5783 | 5784 | ||
5785 | aligned_cluster = max_t(unsigned long, | ||
5786 | empty_cluster + empty_size, | ||
5787 | block_group->full_stripe_len); | ||
5788 | |||
5784 | /* allocate a cluster in this block group */ | 5789 | /* allocate a cluster in this block group */ |
5785 | ret = btrfs_find_space_cluster(trans, root, | 5790 | ret = btrfs_find_space_cluster(trans, root, |
5786 | block_group, last_ptr, | 5791 | block_group, last_ptr, |
5787 | search_start, num_bytes, | 5792 | search_start, num_bytes, |
5788 | empty_cluster + empty_size); | 5793 | aligned_cluster); |
5789 | if (ret == 0) { | 5794 | if (ret == 0) { |
5790 | /* | 5795 | /* |
5791 | * now pull our allocation out of this | 5796 | * now pull our allocation out of this |