diff options
author | Zhao Lei <zhaolei@cn.fujitsu.com> | 2015-01-20 02:11:44 -0500 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-01-21 21:06:49 -0500 |
commit | ffe2d2034bbb34f49f76c808550fdfbea2ea1659 (patch) | |
tree | e77f446b2628d80cff892f604da7ffa292e892ee /fs/btrfs/scrub.c | |
parent | 10f11900167a83e0c229c4c27e73e720ebd55b5c (diff) |
Btrfs: Introduce BTRFS_BLOCK_GROUP_RAID56_MASK to check raid56 simply
So we can check raid56 with:
(map->type & BTRFS_BLOCK_GROUP_RAID56_MASK)
instead of long:
(map->type & (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6))
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/scrub.c')
-rw-r--r-- | fs/btrfs/scrub.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 19781e924443..1ae527c9f8f4 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -1273,7 +1273,7 @@ static inline void scrub_stripe_index_and_offset(u64 logical, u64 map_type, | |||
1273 | { | 1273 | { |
1274 | int i; | 1274 | int i; |
1275 | 1275 | ||
1276 | if (map_type & (BTRFS_BLOCK_GROUP_RAID5 | BTRFS_BLOCK_GROUP_RAID6)) { | 1276 | if (map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) { |
1277 | /* RAID5/6 */ | 1277 | /* RAID5/6 */ |
1278 | for (i = 0; i < nstripes; i++) { | 1278 | for (i = 0; i < nstripes; i++) { |
1279 | if (raid_map[i] == RAID6_Q_STRIPE || | 1279 | if (raid_map[i] == RAID6_Q_STRIPE || |
@@ -1420,8 +1420,7 @@ static void scrub_bio_wait_endio(struct bio *bio, int error) | |||
1420 | static inline int scrub_is_page_on_raid56(struct scrub_page *page) | 1420 | static inline int scrub_is_page_on_raid56(struct scrub_page *page) |
1421 | { | 1421 | { |
1422 | return page->recover && | 1422 | return page->recover && |
1423 | (page->recover->bbio->map_type & (BTRFS_BLOCK_GROUP_RAID5 | | 1423 | (page->recover->bbio->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK); |
1424 | BTRFS_BLOCK_GROUP_RAID6)); | ||
1425 | } | 1424 | } |
1426 | 1425 | ||
1427 | static int scrub_submit_raid56_bio_wait(struct btrfs_fs_info *fs_info, | 1426 | static int scrub_submit_raid56_bio_wait(struct btrfs_fs_info *fs_info, |
@@ -2994,8 +2993,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, | |||
2994 | } else if (map->type & BTRFS_BLOCK_GROUP_DUP) { | 2993 | } else if (map->type & BTRFS_BLOCK_GROUP_DUP) { |
2995 | increment = map->stripe_len; | 2994 | increment = map->stripe_len; |
2996 | mirror_num = num % map->num_stripes + 1; | 2995 | mirror_num = num % map->num_stripes + 1; |
2997 | } else if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | | 2996 | } else if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) { |
2998 | BTRFS_BLOCK_GROUP_RAID6)) { | ||
2999 | get_raid56_logic_offset(physical, num, map, &offset, NULL); | 2997 | get_raid56_logic_offset(physical, num, map, &offset, NULL); |
3000 | increment = map->stripe_len * nr_data_stripes(map); | 2998 | increment = map->stripe_len * nr_data_stripes(map); |
3001 | mirror_num = 1; | 2999 | mirror_num = 1; |
@@ -3029,8 +3027,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, | |||
3029 | */ | 3027 | */ |
3030 | logical = base + offset; | 3028 | logical = base + offset; |
3031 | physical_end = physical + nstripes * map->stripe_len; | 3029 | physical_end = physical + nstripes * map->stripe_len; |
3032 | if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | | 3030 | if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) { |
3033 | BTRFS_BLOCK_GROUP_RAID6)) { | ||
3034 | get_raid56_logic_offset(physical_end, num, | 3031 | get_raid56_logic_offset(physical_end, num, |
3035 | map, &logic_end, NULL); | 3032 | map, &logic_end, NULL); |
3036 | logic_end += base; | 3033 | logic_end += base; |
@@ -3076,8 +3073,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, | |||
3076 | ret = 0; | 3073 | ret = 0; |
3077 | while (physical < physical_end) { | 3074 | while (physical < physical_end) { |
3078 | /* for raid56, we skip parity stripe */ | 3075 | /* for raid56, we skip parity stripe */ |
3079 | if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | | 3076 | if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) { |
3080 | BTRFS_BLOCK_GROUP_RAID6)) { | ||
3081 | ret = get_raid56_logic_offset(physical, num, | 3077 | ret = get_raid56_logic_offset(physical, num, |
3082 | map, &logical, &stripe_logical); | 3078 | map, &logical, &stripe_logical); |
3083 | logical += base; | 3079 | logical += base; |
@@ -3235,8 +3231,7 @@ again: | |||
3235 | scrub_free_csums(sctx); | 3231 | scrub_free_csums(sctx); |
3236 | if (extent_logical + extent_len < | 3232 | if (extent_logical + extent_len < |
3237 | key.objectid + bytes) { | 3233 | key.objectid + bytes) { |
3238 | if (map->type & (BTRFS_BLOCK_GROUP_RAID5 | | 3234 | if (map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) { |
3239 | BTRFS_BLOCK_GROUP_RAID6)) { | ||
3240 | /* | 3235 | /* |
3241 | * loop until we find next data stripe | 3236 | * loop until we find next data stripe |
3242 | * or we have finished all stripes. | 3237 | * or we have finished all stripes. |