diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-04-29 14:12:09 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:02 -0400 |
commit | 2fff734fafa742236aecbdcdc8b1ff4d221cbaca (patch) | |
tree | 2bec8ce43afd242c95535646550a93f383eb2997 /fs/btrfs/volumes.c | |
parent | a236aed14ccb0661611d4416f6b573d892bdc60a (diff) |
Btrfs: Tune stripe selection for raid1 and raid10
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 57ab755aca7..6d8dd4438c7 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 |