summaryrefslogtreecommitdiff
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-09-15 21:08:07 +0800
committerDavid Sterba <dsterba@suse.com>2015-10-21 18:28:48 +0200
commit8789f4fe608922f484369382a8e507ca12df7f4e (patch)
treed956b1ad487ffd551896bced20525bb973088ba2 /fs/btrfs/volumes.c
parentaf902047508d3619499cbbc2f7c4c5e16428b2e3 (diff)
btrfs: use btrfs_raid_array for btrfs_get_num_tolerated_disk_barrier_failures()
btrfs_raid_array[] is used to define all raid attributes, use it to get tolerated_failures in btrfs_get_num_tolerated_disk_barrier_failures(), instead of complex condition in function. It can make code simple and auto-support other possible raid-type in future. Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 2a65d2d45410..7b533909d006 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -48,6 +48,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
.dev_stripes = 1,
.devs_max = 0, /* 0 == as many as possible */
.devs_min = 4,
+ .tolerated_failures = 1,
.devs_increment = 2,
.ncopies = 2,
},
@@ -56,6 +57,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
.dev_stripes = 1,
.devs_max = 2,
.devs_min = 2,
+ .tolerated_failures = 1,
.devs_increment = 2,
.ncopies = 2,
},
@@ -64,6 +66,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
.dev_stripes = 2,
.devs_max = 1,
.devs_min = 1,
+ .tolerated_failures = 0,
.devs_increment = 1,
.ncopies = 2,
},
@@ -72,6 +75,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
.dev_stripes = 1,
.devs_max = 0,
.devs_min = 2,
+ .tolerated_failures = 0,
.devs_increment = 1,
.ncopies = 1,
},
@@ -80,6 +84,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
.dev_stripes = 1,
.devs_max = 1,
.devs_min = 1,
+ .tolerated_failures = 0,
.devs_increment = 1,
.ncopies = 1,
},
@@ -88,6 +93,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
.dev_stripes = 1,
.devs_max = 0,
.devs_min = 2,
+ .tolerated_failures = 1,
.devs_increment = 1,
.ncopies = 2,
},
@@ -96,6 +102,7 @@ const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = {
.dev_stripes = 1,
.devs_max = 0,
.devs_min = 3,
+ .tolerated_failures = 2,
.devs_increment = 1,
.ncopies = 3,
},