summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/volumes.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-04-29 14:12:09 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:02 -0400
commit2fff734fafa742236aecbdcdc8b1ff4d221cbaca (patch)
tree2bec8ce43afd242c95535646550a93f383eb2997 /fs/btrfs/volumes.c
parenta236aed14ccb0661611d4416f6b573d892bdc60a (diff)
downloadop-kernel-dev-2fff734fafa742236aecbdcdc8b1ff4d221cbaca.zip
op-kernel-dev-2fff734fafa742236aecbdcdc8b1ff4d221cbaca.tar.gz
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.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 57ab755..6d8dd44 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -1509,17 +1509,17 @@ again:
if (map->type & BTRFS_BLOCK_GROUP_RAID1) {
if (unplug_page || (rw & (1 << BIO_RW)))
num_stripes = map->num_stripes;
- else if (mirror_num) {
+ else if (mirror_num)
stripe_index = mirror_num - 1;
- } else {
- u64 orig_stripe_nr = stripe_nr;
- stripe_index = do_div(orig_stripe_nr, num_stripes);
- }
+ else
+ stripe_index = current->pid % map->num_stripes;
+
} else if (map->type & BTRFS_BLOCK_GROUP_DUP) {
if (rw & (1 << BIO_RW))
num_stripes = map->num_stripes;
else if (mirror_num)
stripe_index = mirror_num - 1;
+
} else if (map->type & BTRFS_BLOCK_GROUP_RAID10) {
int factor = map->num_stripes / map->sub_stripes;
@@ -1530,11 +1530,8 @@ again:
num_stripes = map->sub_stripes;
else if (mirror_num)
stripe_index += mirror_num - 1;
- else {
- u64 orig_stripe_nr = stripe_nr;
- stripe_index += do_div(orig_stripe_nr,
- map->sub_stripes);
- }
+ else
+ stripe_index += current->pid % map->sub_stripes;
} else {
/*
* after this do_div call, stripe_nr is the number of stripes
OpenPOWER on IntegriCloud