diff options
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 5349e17d8863..1ce581d58d87 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -3562,13 +3562,48 @@ static int btrfs_cmp_device_info(const void *a, const void *b) | |||
3562 | } | 3562 | } |
3563 | 3563 | ||
3564 | struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = { | 3564 | struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = { |
3565 | { 2, 1, 0, 4, 2, 2 /* raid10 */ }, | 3565 | [BTRFS_RAID_RAID10] = { |
3566 | { 1, 1, 2, 2, 2, 2 /* raid1 */ }, | 3566 | .sub_stripes = 2, |
3567 | { 1, 2, 1, 1, 1, 2 /* dup */ }, | 3567 | .dev_stripes = 1, |
3568 | { 1, 1, 0, 2, 1, 1 /* raid0 */ }, | 3568 | .devs_max = 0, /* 0 == as many as possible */ |
3569 | { 1, 1, 1, 1, 1, 1 /* single */ }, | 3569 | .devs_min = 4, |
3570 | .devs_increment = 2, | ||
3571 | .ncopies = 2, | ||
3572 | }, | ||
3573 | [BTRFS_RAID_RAID1] = { | ||
3574 | .sub_stripes = 1, | ||
3575 | .dev_stripes = 1, | ||
3576 | .devs_max = 2, | ||
3577 | .devs_min = 2, | ||
3578 | .devs_increment = 2, | ||
3579 | .ncopies = 2, | ||
3580 | }, | ||
3581 | [BTRFS_RAID_DUP] = { | ||
3582 | .sub_stripes = 1, | ||
3583 | .dev_stripes = 2, | ||
3584 | .devs_max = 1, | ||
3585 | .devs_min = 1, | ||
3586 | .devs_increment = 1, | ||
3587 | .ncopies = 2, | ||
3588 | }, | ||
3589 | [BTRFS_RAID_RAID0] = { | ||
3590 | .sub_stripes = 1, | ||
3591 | .dev_stripes = 1, | ||
3592 | .devs_max = 0, | ||
3593 | .devs_min = 2, | ||
3594 | .devs_increment = 1, | ||
3595 | .ncopies = 1, | ||
3596 | }, | ||
3597 | [BTRFS_RAID_SINGLE] = { | ||
3598 | .sub_stripes = 1, | ||
3599 | .dev_stripes = 1, | ||
3600 | .devs_max = 1, | ||
3601 | .devs_min = 1, | ||
3602 | .devs_increment = 1, | ||
3603 | .ncopies = 1, | ||
3604 | }, | ||
3570 | }; | 3605 | }; |
3571 | 3606 | ||
3572 | static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | 3607 | static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, |
3573 | struct btrfs_root *extent_root, | 3608 | struct btrfs_root *extent_root, |
3574 | struct map_lookup **map_ret, | 3609 | struct map_lookup **map_ret, |