summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Schmidt <list.btrfs@jan-o-sch.net>2012-04-27 12:41:45 -0400
committerChris Mason <chris.mason@oracle.com>2012-04-27 13:55:13 -0400
commit3e74317ad773ba9df36db1fa32848cba41ac4d1a (patch)
treead017d3a85aeaf32dbfd5c63312ff200502d33a7
parent996d282c7ff470f150a467eb4815b90159d04c47 (diff)
downloadblackbird-op-linux-3e74317ad773ba9df36db1fa32848cba41ac4d1a.tar.gz
blackbird-op-linux-3e74317ad773ba9df36db1fa32848cba41ac4d1a.zip
Btrfs: fix repair code for RAID10
btrfs_map_block sets mirror_num, so that the repair code knows eventually which device gave us the read error. For RAID10, mirror_num must be 1 or 2. Before this fix mirror_num was incorrectly related to our stripe index. Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net> Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r--fs/btrfs/volumes.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 3b984173d25b..1411b99555a4 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3807,10 +3807,11 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
else if (mirror_num)
stripe_index += mirror_num - 1;
else {
+ int old_stripe_index = stripe_index;
stripe_index = find_live_mirror(map, stripe_index,
map->sub_stripes, stripe_index +
current->pid % map->sub_stripes);
- mirror_num = stripe_index + 1;
+ mirror_num = stripe_index - old_stripe_index + 1;
}
} else {
/*
OpenPOWER on IntegriCloud