aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r--fs/btrfs/volumes.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 57ab755aca76..6d8dd4438c76 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1509,17 +1509,17 @@ again:
1509 if (map->type & BTRFS_BLOCK_GROUP_RAID1) { 1509 if (map->type & BTRFS_BLOCK_GROUP_RAID1) {
1510 if (unplug_page || (rw & (1 << BIO_RW))) 1510 if (unplug_page || (rw & (1 << BIO_RW)))
1511 num_stripes = map->num_stripes; 1511 num_stripes = map->num_stripes;
1512 else if (mirror_num) { 1512 else if (mirror_num)
1513 stripe_index = mirror_num - 1; 1513 stripe_index = mirror_num - 1;
1514 } else { 1514 else
1515 u64 orig_stripe_nr = stripe_nr; 1515 stripe_index = current->pid % map->num_stripes;
1516 stripe_index = do_div(orig_stripe_nr, num_stripes); 1516
1517 }
1518 } else if (map->type & BTRFS_BLOCK_GROUP_DUP) { 1517 } else if (map->type & BTRFS_BLOCK_GROUP_DUP) {
1519 if (rw & (1 << BIO_RW)) 1518 if (rw & (1 << BIO_RW))
1520 num_stripes = map->num_stripes; 1519 num_stripes = map->num_stripes;
1521 else if (mirror_num) 1520 else if (mirror_num)
1522 stripe_index = mirror_num - 1; 1521 stripe_index = mirror_num - 1;
1522
1523 } else if (map->type & BTRFS_BLOCK_GROUP_RAID10) { 1523 } else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
1524 int factor = map->num_stripes / map->sub_stripes; 1524 int factor = map->num_stripes / map->sub_stripes;
1525 1525
@@ -1530,11 +1530,8 @@ again:
1530 num_stripes = map->sub_stripes; 1530 num_stripes = map->sub_stripes;
1531 else if (mirror_num) 1531 else if (mirror_num)
1532 stripe_index += mirror_num - 1; 1532 stripe_index += mirror_num - 1;
1533 else { 1533 else
1534 u64 orig_stripe_nr = stripe_nr; 1534 stripe_index += current->pid % map->sub_stripes;
1535 stripe_index += do_div(orig_stripe_nr,
1536 map->sub_stripes);
1537 }
1538 } else { 1535 } else {
1539 /* 1536 /*
1540 * after this do_div call, stripe_nr is the number of stripes 1537 * after this do_div call, stripe_nr is the number of stripes