Commit 2fff734f authored by Chris Mason's avatar Chris Mason

Btrfs: Tune stripe selection for raid1 and raid10

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent a236aed1
...@@ -1509,17 +1509,17 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, ...@@ -1509,17 +1509,17 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
if (map->type & BTRFS_BLOCK_GROUP_RAID1) { if (map->type & BTRFS_BLOCK_GROUP_RAID1) {
if (unplug_page || (rw & (1 << BIO_RW))) if (unplug_page || (rw & (1 << BIO_RW)))
num_stripes = map->num_stripes; num_stripes = map->num_stripes;
else if (mirror_num) { else if (mirror_num)
stripe_index = mirror_num - 1; stripe_index = mirror_num - 1;
} else { else
u64 orig_stripe_nr = stripe_nr; stripe_index = current->pid % map->num_stripes;
stripe_index = do_div(orig_stripe_nr, num_stripes);
}
} else if (map->type & BTRFS_BLOCK_GROUP_DUP) { } else if (map->type & BTRFS_BLOCK_GROUP_DUP) {
if (rw & (1 << BIO_RW)) if (rw & (1 << BIO_RW))
num_stripes = map->num_stripes; num_stripes = map->num_stripes;
else if (mirror_num) else if (mirror_num)
stripe_index = mirror_num - 1; stripe_index = mirror_num - 1;
} else if (map->type & BTRFS_BLOCK_GROUP_RAID10) { } else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
int factor = map->num_stripes / map->sub_stripes; int factor = map->num_stripes / map->sub_stripes;
...@@ -1530,11 +1530,8 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw, ...@@ -1530,11 +1530,8 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
num_stripes = map->sub_stripes; num_stripes = map->sub_stripes;
else if (mirror_num) else if (mirror_num)
stripe_index += mirror_num - 1; stripe_index += mirror_num - 1;
else { else
u64 orig_stripe_nr = stripe_nr; stripe_index += current->pid % map->sub_stripes;
stripe_index += do_div(orig_stripe_nr,
map->sub_stripes);
}
} else { } else {
/* /*
* after this do_div call, stripe_nr is the number of stripes * after this do_div call, stripe_nr is the number of stripes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment