diff options
| author | Andreas Philipp <philipp.andreas@gmail.com> | 2013-05-11 07:13:03 -0400 |
|---|---|---|
| committer | Josef Bacik <jbacik@fusionio.com> | 2013-05-17 21:40:20 -0400 |
| commit | 8250dabedb633e162bce89f2aacf5e65fa9e6464 (patch) | |
| tree | 28854bca8fabdb3d7f24c0d982a6aaee09d7223d /fs | |
| parent | 379cde741b220091d2124fb500b178b90ad7f460 (diff) | |
Correct allowed raid levels on balance.
Raid5 with 3 devices is well defined while the old logic allowed
raid5 only with a minimum of 4 devices when converting the block group
profile via btrfs balance. Creating a raid5 with just three devices
using mkfs.btrfs worked always as expected. This is now fixed and the
whole logic is rewritten.
Signed-off-by: Andreas Philipp <philipp.andreas@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/btrfs/volumes.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a191bac31d85..062e93069c5e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
| @@ -3120,14 +3120,13 @@ int btrfs_balance(struct btrfs_balance_control *bctl, | |||
| 3120 | allowed = BTRFS_AVAIL_ALLOC_BIT_SINGLE; | 3120 | allowed = BTRFS_AVAIL_ALLOC_BIT_SINGLE; |
| 3121 | if (num_devices == 1) | 3121 | if (num_devices == 1) |
| 3122 | allowed |= BTRFS_BLOCK_GROUP_DUP; | 3122 | allowed |= BTRFS_BLOCK_GROUP_DUP; |
| 3123 | else if (num_devices < 4) | 3123 | else if (num_devices > 1) |
| 3124 | allowed |= (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1); | 3124 | allowed |= (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1); |
| 3125 | else | 3125 | if (num_devices > 2) |
| 3126 | allowed |= (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID1 | | 3126 | allowed |= BTRFS_BLOCK_GROUP_RAID5; |
| 3127 | BTRFS_BLOCK_GROUP_RAID10 | | 3127 | if (num_devices > 3) |
| 3128 | BTRFS_BLOCK_GROUP_RAID5 | | 3128 | allowed |= (BTRFS_BLOCK_GROUP_RAID10 | |
| 3129 | BTRFS_BLOCK_GROUP_RAID6); | 3129 | BTRFS_BLOCK_GROUP_RAID6); |
| 3130 | |||
| 3131 | if ((bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) && | 3130 | if ((bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) && |
| 3132 | (!alloc_profile_is_valid(bctl->data.target, 1) || | 3131 | (!alloc_profile_is_valid(bctl->data.target, 1) || |
| 3133 | (bctl->data.target & ~allowed))) { | 3132 | (bctl->data.target & ~allowed))) { |
