diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-01-20 02:11:43 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-01-21 21:06:49 -0500 |
commit | 10f11900167a83e0c229c4c27e73e720ebd55b5c (patch) | |
tree | ab1a3b7bd34f51ea09ef505ed518423332f53a99 /fs/btrfs/raid56.c | |
parent | be50a8ddaae1d07135fd7e1c7017c1611075a560 (diff) |
Btrfs: Include map_type in raid_bio
Corrent code use many kinds of "clever" way to determine operation
target's raid type, as:
raid_map != NULL
or
raid_map[MAX_NR] == RAID[56]_Q_STRIPE
To make code easy to maintenance, this patch put raid type into
bbio, and we can always get raid type from bbio with a "stupid"
way.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/raid56.c')
-rw-r--r-- | fs/btrfs/raid56.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index cbc416204452..5264858ed768 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c | |||
@@ -994,10 +994,12 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_root *root, | |||
994 | rbio->bio_pages = p + sizeof(struct page *) * num_pages; | 994 | rbio->bio_pages = p + sizeof(struct page *) * num_pages; |
995 | rbio->dbitmap = p + sizeof(struct page *) * num_pages * 2; | 995 | rbio->dbitmap = p + sizeof(struct page *) * num_pages * 2; |
996 | 996 | ||
997 | if (bbio->raid_map[real_stripes - 1] == RAID6_Q_STRIPE) | 997 | if (bbio->map_type & BTRFS_BLOCK_GROUP_RAID5) |
998 | nr_data = real_stripes - 1; | ||
999 | else if (bbio->map_type & BTRFS_BLOCK_GROUP_RAID6) | ||
998 | nr_data = real_stripes - 2; | 1000 | nr_data = real_stripes - 2; |
999 | else | 1001 | else |
1000 | nr_data = real_stripes - 1; | 1002 | BUG(); |
1001 | 1003 | ||
1002 | rbio->nr_data = nr_data; | 1004 | rbio->nr_data = nr_data; |
1003 | return rbio; | 1005 | return rbio; |
@@ -1850,9 +1852,7 @@ static void __raid_recover_end_io(struct btrfs_raid_bio *rbio) | |||
1850 | } | 1852 | } |
1851 | 1853 | ||
1852 | /* all raid6 handling here */ | 1854 | /* all raid6 handling here */ |
1853 | if (rbio->bbio->raid_map[rbio->real_stripes - 1] == | 1855 | if (rbio->bbio->map_type & BTRFS_BLOCK_GROUP_RAID6) { |
1854 | RAID6_Q_STRIPE) { | ||
1855 | |||
1856 | /* | 1856 | /* |
1857 | * single failure, rebuild from parity raid5 | 1857 | * single failure, rebuild from parity raid5 |
1858 | * style | 1858 | * style |